How to migrate a database from a server to another

The database user name/password is not stored in the database; it is only used to access the database. Change the username (and password, too) to the new values in wp-config.php. And the problem might be access to the database via phpmyadmin; check your username/password in Cpanel or some other hosting control panel.

pull data from a remote wordpress database

Ok. There are few things wrong here. query_posts isn’t mean to be used that way so don’t. Try the same code with $likes=new WP_Query(array(… instead. $likes=new WP_Query(array( ‘post_type’ => ‘post’, ‘ignore_sticky_posts’ => true, ‘filter_type’ => ‘user_liked’, ‘filter_user’ => $user_id )); That is problem one. Then even if $likes were set correctly you’d clobber it. $likes= … Read more

Custom $wpdb returns unexpected time based results

This may be your problem: $wpdb->terms.slug = ‘another-sample’ OR $wpdb->terms.slug = ‘sample’ AND //the date logic doesn’t seem to qork quite right $wpdb->posts.post_date > DATE_SUB( NOW(), INTERVAL 7 DAY)”; Your OR operator might be confusing the query. Try using parentheses: ($wpdb->terms.slug = ‘another-sample’ OR $wpdb->terms.slug = ‘sample’) AND //the date logic doesn’t seem to qork … Read more

Custom SQL query ORDER BY term_order

In your case you are referring ORDER BY {$wpdb->terms}.term_order and as default in wordpress wp_terms table don’t have this column the term_order column resides in the wp_term_relationships table and you are referring wp_terms table to ORDER BY this column which is not is present in that table instead of this you have to do something … Read more

How to use get_results() in widget front end?

It seems that you can’t access to it. Please try add global $wpdb; to your function. UPDATE For reference, in WordPress Codex you will find: WordPress provides a global variable, $wpdb, which is an instantiation of the class already set up to talk to the WordPress database. Always use the global $wpdb variable. (Remember to … Read more

Get a count of how many times a term or a category is used in posts

Wp_Query should be able to do this for you. Pass it the appropriate parameters, including a tax_query, and check found_posts. $p = new WP_Query( array( ‘post_type’ => ‘custcpt’, // your CPT ‘tax_query’ => array( array( ‘taxonomy’ => ‘custtax’, // your tax ‘field’ => ‘id’, ‘terms’ => $cat->term_id, // your term ID ) ), ‘ignore_stickie_posts’ => … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)