Finally I found what causing this problem, turns out it have to do with my pre_get_post hook. Because I using is_page to check the specific page, which is not appropriate.
Here is what I did
function check_page($wp_query){
if($wp_query->is_page(array('1','2','3')) ){
//do something here
}
return $wp_query;
}
add_action( 'pre_get_posts', 'check_page' );
So my solution to this is:
function check_page($wp_query){
$pageidarray = array('1','2','3');
if($wp_query->is_page() && in_array($wp_query->query_vars['page_id'], $pageidarray) ){
//do something here
}
return $wp_query;
}
add_action( 'pre_get_posts', 'check_page' );
Problem solved.
Related Posts:
- Search custom taxonomy term by name
- Determine WP_Query parameters from URL
- Get the post permalink within the loop but without additional DB query
- Multiple instances of Featured Image Query
- Rewrite rule to prettify two $_GET variables while in a new endpoint from a page
- WordPress add_rewrite_rule() cannot visit lower url levels
- How to display an other custom post type in a different custom post type’s archive?
- How to get list of posts from permalinks?
- WP_Query Attachment adds additional attachment count and need to link attachment to post url
- Pagination for blog posts reloading same page [closed]
- Loop posts based on permalink term
- Add URL Rewrite Rule To WordPress
- Getting the permalink to the latest post from a category
- Custom Taxonomy Breaks Pages
- Generate custom output on URL with directory
- How to get child pages and add unique class only to active page?
- The permalink redirecting to current article on single.php page
- WP_Query orderby date not working
- Best way to detect if you are in a SINGLE POST page
- Better way to get tag stats?
- Query two taxonomies via URL or link?
- wp_query order by title
- Sort posts by custom taxonomy name
- Wp_query order by multiple custom fields?
- Would this post meta be better added to the post table rather than post_meta table
- How to exclude products by tag from woocommerce shop page?
- Filtering posts by custom field value not working
- wpdb get results doesn’t work with variable
- Query Ignoring ‘exclude’ Parameter?
- Custom pagination with WP_Query generating 404 error
- Query post with meta_query where date is not in future
- Apply CSS class to every second database record [closed]
- pre_get_posts order by not working
- merge two query arguments into one WP_Query call
- Adding a parameter to the default query
- Using WP_Query in “parse_query” or “pre_get_post” in Posts2Posts
- How do I change the order (ASC and DESC) in the following retrieval method using WP_Query?
- While creating Block Themes in WordPress, how can I query custom posts for an Archive view?
- How To Fix WP Query Returns Results But Shouldn’t?
- Weird orderby => post__in issue
- How to extract specific post
- How to query custom post types with mixed AND & OR statements for custom fields
- Custom post type archive pagination query issue
- 2 weeks ago from meta query meta value
- WP Group posts by year(desc) > month(desc) > date(asc)
- Running main loop 2 times with conditional statement
- paged variable not working for category/custom post archive
- Array as ‘key’ in WP_Query
- Check the Specific Meta Key IF its Meta Value is Empty then… (WP Post Meta Query)
- Searching for meta_key returns 0 posts
- Search Page Returns Nothing
- WP Query causing timeout
- get term id from term name
- Woo Commerce using WP_Query to get products that match price range, with an additional required product attribute
- How to use a dropdown to filter posts by custom field
- Use title of post as argument for query
- Content not displaying on paginated page
- Different Loop for tag pages?
- 2 queries with counters
- Orderby two meta fields not working
- Multiple Query_Posts
- WP_Query: attachment image in “full” size?
- Adding pagination to sub-wp_query within a singular post page
- Page template doesn’t display simple HTML if inserted into other page?
- How to add date_query to meta_query array
- Order by the first array within a meta_query
- How to _GET multiple value checkbox WP_Query in Custom Toxonomy / Custom Fields
- Make a products only viewable to a specific user ID in meta_query pre_get_posts
- get_post_format is not returning standard
- Get categories within specific term
- Exclude parent categories from recent posts list
- How can I query a radius of coordinates?
- custom excerpt is not being shown
- Filtering WP_Query based on wp_postmeta keys values
- WP_Query with meta_query won’t orderby
- Adding Category in WP_Query Not Working
- meta_query only check if both value are set
- post_type not working when tag__in is present?
- How to create page that lists tags by initial letter?
- Seach and categories not working when ignoring sticky posts in main loop
- posts_per_page increment additional post
- WordPress: Cron locking and Queue
- Correct Way To Run Multiple Queries Sharing Some Base Data
- how to query for meta_value have array
- How to make the default WordPress search return borader results
- WP_Query shows all posts on single post pages
- Display Count of posts
- Optimize WP_Query
- Add a custom variable to query page object
- List ALL posts within last week from current category on category page
- WP_Query on “property” in the options table
- Dynamically name array in WordPress loop – add/get values
- Read more redirection problem
- Creating Custom Query
- Help in query for list links
- WP_Query issues with argument posts_per_page
- Search (Custom Form, Custom Search Result)
- Hook to get the query result after listing posts
- Elementor custom query
- How to efficiently find “duplicate” posts, where the titles are different, using metadata to match posts?