The variable is not valorize: $current_user->ID
is 0
, so the query extracts all post, try to give it a non existent integer value
Try to substitute $current_user->ID
with
($current_user->ID==0) : -1 ? $current_user->ID
It assign -1 to the author, if there is no user. So the query must return no results!
Related Posts:
- Limit custom post type to the authors only on front-end!
- Filter date from post meta when date is in string format
- query_posts adding extra code to homepage
- How to show only the most recent post on my custom post type archive?
- How to make WP_Query not to show irrelevant posts?
- What is the ID parameter for custom post types in query_posts?
- Loop for custom post types filtered by a taxonomy
- Author posts not appearing for custom post type
- How to limit post per page of custom post type?
- Custom query – get_the_terms not work
- Display an authors post on a single page only when they are logged in
- 3 random images from custom post type, each in a div with a diffrent class
- Why are some of my custom posts not showing up on my page?
- post-per-page and offset not working
- Control content before and after custom post type loop
- Custom post type, custom taxonomy, query posts only from taxonomy (children of)
- Display custom posts randomly in custom taxonomy archive
- Getting all ID’s matching a title in a custom post type
- why is the current page title being output?
- Count custom post type based on two meta data
- Querying multiple values from a single key
- Not able to export large no. of posts in csv
- attach CPT data to a taxonomy
- Select other roles as custom post authors
- Pagination not working on custom query on a page
- Loop through posts of only 2 statuses
- Targeting custom post type via functions.php doesn’t work
- find custom post type post by searching its custom field with my string
- FacetWP paging custom wp_query
- post body class for current user only if they are the post author
- Restrict category access to specific users/groups. Author always has access
- Can’t change posts per page in WordPress Post Type Query
- postsperpage value not being applied
- Best way to create a search for custom post type by custom field values
- Dynamic category name in query post
- Incorrect ordering of custom post type based on time
- List all posts in taxonomy term
- Find custom post type url by author
- Query all post types but limit to parents
- Display latest posts of author in a custom post type
- Custom post type title of each author in his own post
- get post count for related author
- HM CMB: Post Select Field for CPT ID
- 4 posts per page from single category
- Display author box on just certain category posts?
- Display Posts Query with IF function
- Display custom post counts for author , not default posts
- Query Multiple Custom Post Types & Exclude a Taxonomy Term
- Custom Post type showing up in loop, regular posts are not showing up
- Query Custom Post Type based on text input
- Getting custom post type info using get_adjacent_post
- Use Author Ids or Names to echo different output inside loop
- Custom Post Type Query W/Category Dropdown
- Query all posts under one taxonomy? Why is my code not working?
- Creating an option for writing a post without an author attribution for a group blog on WordPress
- Custom Post Types Not Showing Up In query_posts Result
- Find Posts based on Child Post value
- Query for bbPress replies to current topic?
- Custom Post Type ‘Event’: Chronological list of recurring events from meta_values in array
- Why can’t I query more than 1 post type at a time?
- Sorting the Loop by Taxonomy Value
- “Author” custom post type
- Custom Query: Multiple CPTs and a taxonomy filter
- WP query_posts group by meta field related
- returning the currect URL for nested posts
- Sticky posts limit query and pagination for a custom post type
- Custom wp-query display post only today
- Custom post type archive page filters
- Filling custom post type posts from a rest api
- custom post type and a “sticky” position taxonomy
- how to display author name in custom post type
- Create a post automatically if search result has zero results
- Trying to list years (for a filter) but not all years display
- custom post type and user post count shortcode
- Modify default Related Posts Code to Custom Post Type
- Posts per Page on custom Taxonomy Template
- Use WP_query to match post types based on custom field values
- Order Posts in Custom Order
- How do I get all authors posts of a custom post type outside loop
- minimize wp_query call to database
- Why is wp_list_authors not picking up Authors from CPT’s?
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- Group Custom Posts Types in a Relation field of ACF
- Use WP pagination functions on a custom page template
- Delete Post by User
- Can I show some specific post rather than latest post?
- Getting Custom Posts with Custom Taxonomy
- Query the title of the page to show posts with matching category in the loop
- How to make id user can be view content
- Display posts on parent post if author coincides
- Author archive custom posts only?
- update a posts of other custom post type
- Set a static page as a user profile page?
- How to Create movie schedule by custom post type query
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- Main site single-property.php design, as homepage of a multisite
- I want to link an author to everything from any post type that they publish on the website
- How to set class to “current-page” on the currently viewed single post within a CPT
- Imported Content Doesnt Show Up On Frontend
- Optimise custom post type queries