To display Custom Post Types in the regular Recent Post widget for sidebar(s),
we use following function which works flawless for us.
We use our own functions and try to prevent overhead often created by plugins.
Note: make a backup before adding this function into
functions.php
/**
* Display CPT on Recent Post widget
*
* @version WP 4.6.1
*/
add_filter( 'widget_posts_args', 'wpse241060_widget_recent_post_4_cpt' );
function wpse241060_widget_recent_post_4_cpt( $params )
{
$params['post_type'] = array( 'post', 'cpt01', 'cpt02');
return $params;
}
Read more in Codex
Related Posts:
- WP_Query Pagination on single-custom.php
- How to get post content by calling ajax?
- Make featured image required
- previous_post_link() and next_post_link() with a custom post type?
- Get category id from post id of a custom post type
- Setting a custom sub-path for blog without using pages?
- Limit widget to a specific registered sidebar
- WP_List_Table Inside Metabox Not Working on Submit
- Why get_next_post_link() or get_previous_post_link() doesn’t return the required links?
- Add metabox with media uploader in a custom post type [duplicate]
- Custom Posts on Different Pages
- Newer/Older posts links display same posts on every page
- taxonomy list display custom post count
- automatically create taxonomy with same name as post title
- Wp-query causing problems with the_content();
- Custom Post Type by user
- saving custom post type data to different table in wordpress
- How to create posts (not post template) to be displayed on projects page?
- Display “Post 2 of 4” on single post page?
- Query post types with multiple keys
- same archive template for different custom post
- When viewing single parent post, display list of children
- Limit Authors to their Own Posts on front-end excluding admins
- Remove Post Page “View Post” Link
- Adding Custom Taxonomy to WordPress default Post type
- Get all posts WHERE custom_field is LIKE value
- Post type hierarchy
- How to display recent / random posts by its category
- How to make post sticky in the admin page?
- Loop on front-page.php
- WP_Query is printing out only one post when posts_per_page is set to multiple
- How to get all posts except for one post from a certain custom post type?
- Exclude child pages from archive.php
- How to create custom boxes with text inside?
- Adding dropdown select meta box to custom post type – seems restAPI is interfering
- Using The REST API How To Pull All Custom Posts?
- List children on child post
- Restrict custom post type from appearing with ?post_types=
- How do I do this with WordPress? Taxonomies?
- Disable block with taxonomies at post page
- Which post does a taxonomy term belongs to?
- Changing custom type name hides the posts
- Display Ad on Specific Categories
- Add custom field to Posts and sort by it
- Two Custom Post Types Many to Many Relationship
- Problem with displaying posts in the CPT category
- Show titles, date of all posts on single category page
- How to change the post type a theme shows by default?
- No Permission to add new Page, Post or CPT with Admin role
- Update postmeta Parent when post_status child change
- Set up post page like JAMA articles
- Shortcode not working with post counter
- Allow users to create posts without logging in?
- Create new custom post and post category of same name
- Load Next WordPress Posts With AJAX?
- If there is only one post (show elements) else (show other elements)
- Custom post type menu
- widget_posts_args not using the number of posts in widget
- Modify Posts from Custom_Post_Type within the plugin
- How do I edit the WordPress post.php file?
- Posts are not rendering perfectly [closed]
- How I can made a custom post type to page templates?
- List all posts in taxonomy term
- how to redirect to a custom post template
- Post/Custom Post Type URL Access
- Adding /blog in front of single posts (only)
- list articles in admin showing nested categories or slugs?
- Search CPT by tag ids
- Post template with breadcrumb needs to show page navigated from
- Define multiple prefixes for custom post type
- Publishing failed. The response is not a valid JSON response
- add all blog posts to folder
- Show posts from WP Custom Post Type selected from a field in a metabox
- order custom post type posts by custom date
- How to show posts of the same category on a page?
- custom post type to post association in wordpress
- Need to display author’s email id in the “Edit post” field in wp dashboard. How do I do this?
- How to get all posts related to a taxonomy?
- call a function when insert and update a custom post type
- Work and Display a Custom Post Type as a normal Post
- Most efficient way of showing children posts?
- Custom post type with two templates
- One Post with different content, depending on a Page
- Custom Post Type
- Popup panel is only displaying 1 entry ignoring all others
- Custom Post Status & Taxonomies
- How to display data with pagaination on backend?
- Edit post meta direct from post.php?
- How to Arrange Support => Thumbnail
- Front-end form submission not creating post
- Post being scheduled that shouldnt be schedulded
- Get custom post type parent category
- How to delete unnecessary custom post types in the UI
- show the most recent date of all posts to display on front end
- Error 403 when posting comments to a custom post type from a different page
- How to change post cpt with submit button?
- Storing every individual update to the posts being updated over time?
- Change post structure
- Post URL redirecting to homepage
- Adding a new custom post type using the editor causes 502 bad gateway error