Custom Post Type order by modified date and custom meta field issue

If I understand you, I believe that the following will do what you need: function orderby_mod_wpse_140999($orderby) { remove_action(‘posts_orderby’,’orderby_mod_wpse_140999′); global $wpdb; return $orderby.”, {$wpdb->posts}.post_modified DESC”; } add_filter(‘posts_orderby’,’orderby_mod_wpse_140999′); $args = array( ‘meta_key’ => ‘premium’, ‘orderby’ => ‘meta_value’, ‘order’ => ‘ASC’ ); $q = new WP_Query($args); var_dump($q->request); The key names may be wrong and it may be (probably … Read more

How Do I Merge Categories With phpMyAdmin

You can’t simply “merge categories” you have to change the category that each post is associated with. The table WP_TERM_RELATIONSHIPS links posts with categories. You could try something like this: UPDATE wp_term_relationships SET term_taxonomy_id = (SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id = 112748) WHERE term_taxonomy_id = (SELECT term_taxonomy_id FROM wp_term_taxonomy WHERE term_id = 112747) You … Read more

How do you query wordpress posts using a math formula between multiple meta field values?

I think the easiest way would be to create a third meta field for “score” and use the WordPress update_post_meta() function to automatically calculate its value, based on the values of assignment_value and current_grade. Exactly how to do that has been answered well in this response: https://wordpress.stackexchange.com/a/54068/16 Once you have your third “Score” meta field, … Read more

Filter custom post types in archive

The problem is that you’re using term IDs in your URL, but that is incorrect. Use the term slug instead. For example, lets say we have a mytax term named helloworld with the term ID 1: example.com/cpt/?mytax=1 404 example.com/cpt/?mytax=helloworld a cpt archive filtered by the helloworld term

Help with wordpress custom query and advanced custom fields plugin

$yesterday = array ( ‘year’ => date(‘y’), ‘month’ => date(‘m’), ‘day’ => date(‘d’)-1 ); $rows = $wpdb->query($wpdb->prepare(*emphasized text* “SELECT id, yymmdd FROM plugin_data WHERE yymmdd LIKE ‘%d-%d-%d”, $yesterday[‘year’], $yesterday[‘month’], $yesterday[‘day’] )); foreach ( $rows as $r ) { $id_for_yesterday_rows[]= $r->id; } Now you have all ids or rows that were submitted yesterday in an array.

Get the timout value of a saved transient?

So, after one minute of more thinking, there is an easy solution, although i did not try it myself: $transient=”_transient_timeout_” . $_your_transient_name; $transient_timeout = get_option ( $transient ); you should be ready to go with this. Another Way throught the database would be: $transient=”_transient_timeout_” . $_your_transient_name; global $wpdb; $query = ‘SELECT option_value FROM ‘ . … Read more

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