Include one page/post into query which is already returning posts

And here is the correct implementation: Register the category taxonomy for the page post-type: function wpse121285_add_category_to_pages() { register_taxonomy_for_object_type(‘category’, ‘page’); } add_action( ‘admin_init’, ‘wpse121285_add_category_to_pages’ ); Add the appropriate category term to the desired page. Then modify the default $wp_query object at pre_get_posts: function wpse121285_pre_get_posts( $query ) { // Main query for the blog posts index // … Read more

Using in ‘category_name’ in ‘$query->set();’?

I am unable to duplicate the problem, but the Notice references this line: add_screen_option( ‘per_page’, array( ‘label’ => $title, ‘default’ => 20, ‘option’ => ‘edit_’ . $post_type . ‘_per_page’ ) ); And that makes me think that you should be passing a post type in your GET string. http://wp.dev/wp-admin/edit.php?post_type=post&category_name=intl Just a guess as I can’t … Read more

How to display data from db in select list [closed]

You’re recreating the select element on every iteration through the loop, and you need to name your current loop assignment variable differently, as you’re overwriting your original. Lastly, you’re also not assigning a value to the options within the loop, so you’re not going to get anything on the form submission, and text isn’t a … Read more

Taxonomy filter under Polylang

I got it. With help from this answer: get all posts ID from a category $post_type_ids = get_posts(array( ‘numberposts’ => -1, // get all posts. ‘post_type’ => ‘texto’, ‘fields’ => ‘ids’, // Only get post IDs ));

Unable to paginate a custom page query

The problem was in the same name for category slug “categories” and the same for the custom page that was holding all categories with the same name “categories”. I have solved that by changing categories slug (in permalinks settings) to singular “category” and I have left custom page as plural “categories”. If somebody know about … Read more

Querying Advanced Custom Fields

Try using a meta_query in your $args. You are far more flexible this way. For the full reference of the possibilities check the Codex $args = array( ‘post_type’ => ‘Product’, ‘posts_per_page’ => -1, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘meta_query’ => array( array( ‘key’ => ‘product_type’, ‘value’ => ‘Paper’, ‘compare’ => ‘=’, ) ) );