add add_action('init', 'create_new_cpt2');
in your snippet and modify add_db_to_article function as below,
function add_db_to_article ($post_types) {
$custom_post_types = array ('article', 'news');
$output = array_merge($post_types, $custom_post_types);
return $output;
}
Note: ‘news’ is added in $custom_post_types array.
Related Posts:
- Showing custom post type categories in the menu
- Need help with Custom Post Types and Taxonomies
- wordpress does not see the correct custom taxonomy hierarchy
- How to change default position of WP meta boxes?
- Displaying Custom Post Types In “At A Glance” Meta Box
- Display a query with multiple post types and same relationship on a single page
- how to group custom post types
- echo value from ‘select’ field type into page template using cmb2?
- Exclude add_filter from the admin
- WordPress 3.1 – How does one add sticky post capabilities to post types
- Posts to expire (deleted) after a date
- White screen error for a custom theme
- Automatically assign a custom post to a custom taxonomy based on custom field value
- Exclude Custom Post Type & Pages From Auto-Tag Function
- Custom user role not working as expected
- Limit Authors to their Own Posts on front-end excluding admins
- Beginner question: Accessing functions.php through admin web interface in order to import custom post types?
- Post the content of a specific “Custom Post Type” post within a post using a shortcode
- Need functionality with all post list available at edit.php
- Remove default post types on all sites except primary blog. WPMU
- How to change the admin menu “Pages” to something else
- Apply post formats to a specific post type only?
- How would I create a shortcode to display a custom post within a page or regular post?
- Loading all files within a directory
- Custom Post Types relationships
- Copy custom field value to post title
- Insert HTML inside link in a walker
- What’s the difference between same wp functions get_posts(); functions in different form?
- Function to display custom post type on front page makes menu items dissapear
- Custom Post Type with Templates using Meta Boxes?
- Can I list a custom post type within another custom post type in the admin area?
- Set URL link to featured image of custom post type
- On update or create post redirect to current post position in list
- Redirect 404 page with ID in slug to associated page with same ID in slug
- Display featured image from one CPT within another CPT query
- create a new page from a custom post type similar to an authors page
- Anon function and add_meta_box
- Shortcode not working with post counter
- Changing default ‘posts’ parameters with register_post_type_args
- Allow users to create posts without logging in?
- Load scripts based on post type
- Meta-Boxes for CustomPostType cause PHP Errors and Notices in “Add New” view
- categories should be available across all custom post types
- Warning: Invalid argument supplied for foreach() in post.php [closed]
- Adding predefined terms to a taxonomy
- Post-thumbnail only for specific post-types?
- custom post type metaboxes not saving
- Enable taxonomies by post type in an array of CPTs
- How to use a variable as a function name?
- providing access to post_id or post inside functions.php
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- Custom Ratings for Theme, Proper way to Refactor Code and Clean up Template File
- Get post format
- posts within custom post type all share the same content in the front-end
- Shortcode to return single custom post based on post taxonomy
- Using Wp_Query, Json to add Highcharts series data
- Template code to split a post and print a custom field?
- Send post changes to set email addresses (not users or subscribers)
- Function to limit number of custom post types on homepage – TwentyTen
- Let users upload image(s) to the post from front end
- Foreach loop returning more than one item when querying taxonomy
- Have custom post type Visibility be private by default, and have radio button also set to “Private”
- Post visibility option to theme front-end for author to select?
- Sorting custom post types in edit.php : Post disappear
- display custom portfolio tags
- Page template that uses lightbox to display post images
- display custom post on separate page
- Post type Echo code is repeating on homepage
- Function to allow single post template based on custom taxonomy?
- Get Posts List of Current Selected Custom Taxonomy in Shortcode
- What is the best way to set the post category (Custom Post Type) automatically based on the one of the tags assigned to the post?
- Custom Form / Search with Custom Post Type Data
- php dynamic content inside shortcode
- Check that a slug is present in the get_terms request
- Custom attachment function not working in v5.4.2?
- Cannot display the_content() after removed WordPress 5’s auto embed feature (iframe & blockquote)
- Update main post with same category when creating custom post to update the modified date
- CPT tags not showing when editing post
- Attend event form with ajax
- Persist meta box choices throughout all posts of same post type
- subtracting the current post form then whole loop, which is generating all CPT titles
- Custom Function to redirect singular post if specific meta field is empty
- If thumbnail image else post title
- Function for when new custom post type is created should do something
- URL with Hierarchical Taxonomies and same slug for all terms and sub-terms
- When post is Published, insert into custom table a number – custom post type
- Getting a 404 on single custom post type page when using rewrite on a custom taxonomy
- Pagination fault in custom post type archive page [duplicate]
- How can i call a custom method on submission of a custom plugin post type?
- Set the Title of a Custom Post Type by code as Author’s Username
- Function not pulling image or text from custom post type
- Rich Custom Field for Custom Post type not saving
- Can’t preview custom post – Redirected to home page
- Custom Loop for custom post type. Compare by meta_value?
- Post AND page parameter for WP function
- How to string lines from the_content() hook in WordPress?
- Passing postid of Testimonial Custom Post in Shortcode Parameter
- How to I add count of custom posts listed in a post as a prefix to its title
- add_rewrite_rule not working with custom post type
- I want to show a list of post with title that have link goes to that post and icon under the specific category to which it belongs