If you use WordPress author template to show user posts ( example.com/author/{user_name}
) the best solution will be to change the main query via the pre_get_posts filter hook.
function se339534_author_any_post_types $query ) {
// apply changes only for author archive page
if ( ! is_author() || ! $query->is_main_query() )
return;
$query->set('post_type', 'any');
}
add_action( 'pre_get_posts', 'se339534_author_any_post_types' );
Related Posts:
- Author must complete profile info before they can publish a post?
- static landing page leading to author specific pages w/ “live” content
- All Posts Linking to Author Posts directly
- Change Author Name to Sitename on Frontend
- Prevent 404 of Author pages without posts
- Get the Current Page Number
- Stop WP from creating “Sample Page” and “Hello World!” post
- How to display by default only published posts/pages in the admin area?
- Delete Associated Media Upon Page Deletion
- How to Check if a Page Exists by URL?
- How to add editor’s name to entry meta byline?
- Restore contents of deleted user
- Display posts by tag on page
- What is the difference between “post” and “page” in WordPress?
- posts page – different lengths of excerpt
- WordPress automatic and permanent page
- Get the user type of an author
- Show the title of the latest post by author
- Filter posts by author and category simultaneously
- Can I change a post to a page by changing it’s type?
- Add a custom option to a page in backend
- Creating new page with pre-defined parent page
- Get all posts by post_author
- Populating a page with content from post custom fields
- When paginating a Page with the tag, how can the 2nd and subsequent page styles be customised?
- Authors in menu, template list post by author
- disable column on post and user list
- WP_Query do not load specifed number of post
- Can a page_id and a post_id be same?
- How can I display widget in a Page or Post?
- Differentiate between posts and pages in search results
- Getting a 404 error when clicking edit page
- Show info to author only
- Specifying # of Posts per page using inline post plugin (:
- Can I use images as anchor tags with
- Create posts under certain page
- Should I use posts or pages in this scenario?
- Switch to page template when using post permalink
- How to handle broken links created by permalink/slug changes?
- When open add new post or page WordPress add post with ID=0 continuously [closed]
- Hooking into the post editing screen for an existing page only
- Display Notification Bar on Header on Certain Post Count
- How do I do a page break?
- When changing pages to posts, how do you set up 301 redirects for the page URLs?
- How do I retrieve a users’ last 5 posts?
- User Selectable Delete of Pages
- obtain the author id given the post id
- How to get ID of the page included with get_page()?
- is_page() and is_page_template() not being differentiated
- Display an authors post on a single page only when they are logged in
- How to show all posts by author on buddypress profile with navigation
- How to create a “latest news” page showing a list of posts from blog category
- How do you search for a post or page with a certain url on the WordPress admin panel?
- How to get the ability to change the author of a post
- WordPress 302 Redirect to Random Product/Post/Page
- Only allow posts with a specific term to only be viewed by other authors with the same term in their post
- How to limit author related post listing ?
- Display Featured Posts Grid on Static Page (Gazette)
- Get total post from an author
- Having pages after specifying post_type post
- Direct some posts to only appear on a specific page
- Different post views for different category views
- Indenting within a blockquote
- I want to add another search box on posts page in dashboard
- Change published date and time using SQL query for page in every 5 hour
- Restricting displayed posts to posts from only select authors
- WordPress Sticky Post Count “Fix” Breaking Pagecount by 72 pages!
- Limit Post Creation Count by Author or Role
- WordPress: Develop multiple posts with different data
- Blocked posts in network tab
- How to add a block to a category page?
- How do I customize the post page
- Clicking on a Post takes 10+ seconds for the server to respond, Pages will respond immediately
- Page with Category Returning 1
- calling pages instead of posts
- WordPress display page information rather than post
- Post Category link is same with Page link
- Precedence of page permalinks over woocommerce product category links?
- Changing the Category for all posts of an Author
- List of authors posts minus very latest
- Page and Posts loading as index page? Not loading the content
- show latest authors blog post
- Converting Posts to Pages
- Page not loading content – Body archive – page
- 404 error on every post and page other than home
- Using Post ID and Page ID in same function
- Display the current post author and his url in the post header
- Get post title of faulty link on 404 error page
- How to display a paginated list of posts from one category on a page? [duplicate]
- Why is $_POST Empty in Profile Edit Admin?
- The next_posts_link() works only with original $wp_query
- Show last post of employee in his profile page
- Redirecting posts in WordPress to a specific page
- Notify Author of the post if admin deletes his post and perform some function
- Limit amount of pages shown in pagination within wp_query
- Wrap div-tag around posts in page
- When and how will php code in a user made WordPress page be executed?
- How can I add Author’s phone number to wp profile and make it appear in wp-admin/edit.php columns
- The page that displays Posts on homepage
- Post data returning null [closed]