Problem:
It seems to be caused by the theme function that makes it possible to include custom post types in the query on the home page.
function namespace_add_custom_types( $query ) { if( is_front_page() || is_category() || is_tag() && empty( $query->query_vars['suppress_filters'] ) ) { $query->set( 'post_type', array( 'post', 'nav_menu_item', 'recipe', 'news', 'feature' )); return $query; } } add_filter( 'pre_get_posts', 'namespace_add_custom_types' );
Solution:
For the wordpress built-in action hook pre_get_posts, please follow wordpress document to setup your custom codes:
https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
There is an example codes in above document:
section "Include Custom Post Types in Search Results"
Relevant Documentation:
https://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts
This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.
Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.
Sun | Mon | Tue | Wed | Thu | Fri | Sat |
---|---|---|---|---|---|---|
- | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | 9:00 – 13:00 | - |
- | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | 14:00 – 18:00 | - |
Supporter timezone: Asia/Hong_Kong (GMT+08:00)
This topic contains 4 replies, has 2 voices.
Last updated by zoeS 7 years, 5 months ago.
Assisted by: Luo Yang.