WordPress WP_Query offset parameter not working with search parameter
WordPress WP_Query offset parameter not working with search parameter
WordPress WP_Query offset parameter not working with search parameter
Found the problem. In my args, I should have included this line: ‘post_type’ => array( ‘one’, ‘two’, ‘three’, ‘four’, ‘five’, ‘six’ ), above the ‘tag’ arguments
EDIT: Well, it seems the following approach is a bit DB consuming. Pieter Goosen posted a very interesting alternative. Since this approach has already been accepted as a correct answer I don’t know, it it is possible to mark this question still as a duplicate. I flagged my answer so a moderator might have a … Read more
Ok, so the answer here is both annoying and fairly difficult to find/fix. The wp_dropdown_categories() function outputs the dropdown for each custom taxonomy filter using the term_id as the value for each option. However, when constructing the query the WP_Query::parse_tax_query() method, by default, sets the field element to slug. So, I had to make a … Read more
The problem was due to the fact that the query was restructured in this latest update. As pointed out by d79 in this question, the query changed from: SELECT DISTINCT SQL_CALC_FOUND_ROWS wp_users.* FROM wp_users INNER JOIN wp_usermeta ON ( wp_users.ID = wp_usermeta.user_id ) INNER JOIN wp_usermeta AS mt1 ON ( wp_users.ID = mt1.user_id ) WHERE … Read more
UPDATE: Ok this should work, according to ACF’s documentation: $args = array( ‘posts_per_page’ => -1, ‘post_type’ => ‘page’, ‘meta_query’ => array( array( ‘key’ => ‘feature_on_front_page’, ‘value’ => ‘featured’, ‘compare’ => ‘LIKE’ ), ) ); Your code works for me. Can you see the feature_on_front_page custom field when you view the page(s) in the WordPress admin … Read more
I updated my question with a partial answer to this problem. By adding an underscore ‘_’ before the name of the meta field it allows you to add meta data without it creating an editable custom field on the page edit screen. update_post_meta( get_queried_object()->ID, ‘_term_id’, $meta_term_id);
You can use get_page_by_title to match the title of the required post. $post_name = get_page_by_title( ‘Post Title’ ); $vars = array( ‘name’ => $post_name, ‘paged’ => $page, ‘posts_per_page’ => intval($posts), ‘order’ => ‘asc’, ‘offset’ => ($offset ? $offset : ”), ‘orderby’ => ‘title’ );
You need to use a meta query: if ( isset( $_REQUEST[‘src’] ) ) { $query = array( ‘post_type’ => ‘post’, ‘meta_query’ => array( ), ); if ( isset( $_REQUEST[‘srcbusiness’] ) ) { $query[‘category_name’] = wp_unslash( $_REQUEST[‘srcbusiness’] ); } $fields = array( ‘srctype’, ‘srcprice’, ‘srccity’, ‘srcdistrict’, ); foreach ( $fields as $field ) { if ( … Read more
Show portfolio items in template – how?