I’ve got a site with a News page (archive for category ‘news’) and a separate Blog page. When I make a post for the News page I select the...
this question is strongly related to this question where I already got a working answer. I have a custom-post-template named “wr_event” and a custom-taxonomy named “event_type”. This “event-posts” have...
I added the following to my functions.php: add_action('pre_get_posts', 'keyl_get_emp_posts'); function keyl_get_emp_posts($query) { if ($query->is_main_query()) $query->set('post_type', 'employee'); } and so far it’s effectively filtering out the search results. The default...
I have an CPT archive page that I would like to exclude certain posts from if a field is null. The field I want to look for is title_group...
I need a conditional tag which returns true on all categories added to a specific custom post type. Tried dozens of variations using the conditional tags from the Codex...
I am trying to alter WP_Query on the pre_get_posts action hook, for filtering the posts returned, depending on the built-in category and post_tag taxonomies. I would like that the...
The following bit of code was used in my fictitious plugin to redirect the non-logged-in users from page 173 (ID) to sample-page (slug). The code’s working well. But just...
I have thousands of posts that I am displaying on my home page. I want to control number of posts so for this I am using posts_per_pagebut it is...
I’m trying to filter the query on a sub page called “Ask Question” to list all of the recent questions submitted by users, but I get a 404 when...
Referencing @Otto’s response to a question I also had about ordering by multiple fields, here is what he said: Can’t do it with a naive WP_Query. Use the posts_orderby...