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
- I need to add endpoint for wordpress categories
- How to target a specific custom post type post and its all children and grandchildren?
- Featured image overlay when changing post status
- get_post_meta not working on publishing
- Redirect 404 page with ID in slug to associated page with same ID in slug
- WordPress wrapped added a span tag to every single p tag
- ACF field key/value to show on taxonomy list
- Re-registering a custom post type not working (not showing up)
- Display featured image from one CPT within another CPT query
- how can I register a post_meta field in an existing CPT and then call it again with get_post_custom()?
- Query taxonomy of taxonomy of custom post type
- Best way to style first post differently?
- How to make custom posts types display when published for the future
- How to rewrite url for any specific taxonomy?
- create a new page from a custom post type similar to an authors page
- CPT archive admin menu label
- Anon function and add_meta_box
- Hide a widget inside a div on specific type of post
- Shortcode not working with post counter
- Changing default ‘posts’ parameters with register_post_type_args
- Homepage’s content is dependent on the custom field values (set automatically), how do I get homepage to update without manually updating page?
- Cannot save CPT meta box
- Allow users to create posts without logging in?
- How to change permalink to include custom post type
- Configuring a meta query with multiple post types that have the same relationship on a single page
- Add term to custom post type on draft
- How to assign classes to all elements?
- next_/previous_post_link() `in_same_category` appears to fail when true
- Want to be able to sign up subscribers as authors
- Load scripts based on post type
- Different Category system needed for the Custom Post Type
- Global custom meta box
- Template not working for the custom Post type
- Warning: Invalid argument supplied for foreach() [closed]
- Custom post type isn’t working
- 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
- Featured Image field not appearing in Custom post type
- Post-thumbnail only for specific post-types?
- custom post type metaboxes not saving
- Custom Post Type & Custom Menu Walker to append custom class for active post types
- Enable taxonomies by post type in an array of CPTs
- PHP question: how to combine syntax?
- Loop increase number
- custom post for slider
- ACF in wordpress
- Change Slug of a Custom Post Type
- Excerpt function for any content
- Assign category a default post type
- Navigate posts with different post type that are in the same categories
- List of all entries of custom-post-type: Add year-parameter?
- Add an Outside Wrapper to my Header and Make it Full Width
- Page Template Dropdown For Custom Post Types
- How to use a variable as a function name?
- Show Custom Message in WordPress Admin
- How to inherit field value from parent post into in child / sub post
- How exclude or skip post type with get_next_post_link
- Prevent A Specific Custom Post Type Showing In WP Search Results Page
- Create short URL with auto 301 redirect
- Custom post type’s posts are not showing anywere but in xml sitemap
- CPT Taxonomy As Archive Page – Error 404
- providing access to post_id or post inside functions.php
- Removing full title and breadcrumb header container for a specific post type
- Is it possible to use array_walk() to append terms to an array of posts?
- WordPress notification if new post published
- Run shortcode in custom script in wp_head if post type is CPT ‘Jobs’
- Get current user id
- Show current user posts in custom post type query
- Custom Ratings for Theme, Proper way to Refactor Code and Clean up Template File
- Rewrite permalink for multiple post types (CPT) with taxonomy term
- Get post format
- posts within custom post type all share the same content in the front-end
- post_content is stripping HTML when adding a new post? [closed]
- Shortcode to return single custom post based on post taxonomy
- Custom post type in Custom widget – $listItem
- 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)
- Custom posts – tag pagination
- Adding custom post formatting options in custom post types
- Twitter Product Cards
- Function to limit number of custom post types on homepage – TwentyTen
- Custom meta box in custom post type not working
- Meta box not appearing in my custom post type
- Let users upload image(s) to the post from front end
- Foreach loop returning more than one item when querying taxonomy
- Function to erase every post from a taxonomy
- Have custom post type Visibility be private by default, and have radio button also set to “Private”
- Redirect to URL if x number of days passed
- Display author box on just certain category posts?
- Post visibility option to theme front-end for author to select?
- Excerpt length: get first paragraph
- Function to add custom HTML into head in custom post-type list page
- Sorting custom post types in edit.php : Post disappear
- display custom portfolio tags