fix(query): ensure accurate post type exclusion logic
Updated logic to properly exclude posts from main queries based on theme settings. This change ensures that only posts are excluded when the 'disable_posts' setting is enabled, preventing unintended behavior for other post types.
This commit is contained in:
parent
bee50a461d
commit
97935f9401
1 changed files with 2 additions and 2 deletions
|
@ -1081,8 +1081,8 @@ function exclude_posts_from_queries($query)
|
|||
{
|
||||
if (!is_admin() && $query->is_main_query()) {
|
||||
$disable_posts = get_theme_mod('disable_posts', false);
|
||||
if ($disable_posts) {
|
||||
$query->set('post_type', array('page'));
|
||||
if ($disable_posts && $query->get('post_type') === 'post') {
|
||||
$query->set('post_type', 'page');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue