WP Query with meta queries

You have to use “orderby” => “meta_value_num” and set a “meta_query” at the same time. Then choose the “meta_key” you want to order by. Try: $query = new WP_Query( array( ‘post_type’ => ‘some_cpt’, ‘posts_per_page’ => – 1, ‘meta_query’ => array( array( ‘key’ => ‘active’, ‘value’ => ‘1’, ‘compare’ => ‘=’, ) ), ‘meta_key’ => ‘ranking’, … Read more

Save_post acf data not updating category of post type

You can not use is_single() conditional tag here. You can check the type of post in the function this way: add_action( ‘save_post’, ‘set_genre_on_save’, 20, 3 ); function set_genre_on_save( $post_id, $post, $update ) { if ($post->post_type != ‘hvm’) return; // … } You can also attach the function to the action hook save_post_{post_type}, which is triggered … Read more

How to use germ_terms() with meta_query for ACF Taxonomy field?

Answer – the correct formulation is… ‘meta_query’ => array( array( ‘key’ => ‘Topic’, ‘value’ => “12057”, ‘compare’ => ‘LIKE’ ) ) In full: ` $args = array( ‘taxonomy’ => ‘event’, // ‘order’ => ‘ASC’, ‘hide_empty’ => false, ‘hierarchical’ => true, // ‘parent’ => 0, ‘meta_query’ => array( array( ‘key’ => ‘Topic’, ‘value’ => “12057”, ‘compare’ … Read more

List all ACF field values across every post on one page

You want to start here and here. Essentially you’re just looping through all your posts like normal and then adding some custom fields into it. Be sure to reference the Repeater Field documentation. This should work inside a loop. Notice you’ll need your post ID. <ul> <?php if( have_rows(‘YOURREPEATERFIELDNAMEHERE’, ‘POSTIDHERE’) ): while ( have_rows(‘YOURREPEATERFIELDNAMEHERE’, ‘POSTIDHERE’) … Read more

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