You can stop executing the function if the post is not of a specific post type. You can use get_post_type() for this.
if( 'masters' != get_post_type( $post_id ) )
return;
Related Posts:
- Automatically fill custom field value on post publish/update
- wp_update_post based function works on existing posts, but not new posts
- Updating post title using wp_update_post
- How Can I Set the Post Author of a Post I Just Created With PHP?
- Insert and then update post_type by wp_update_post
- Posts are duplicating on wp_post_update
- Post author for revision not being set on update/insert
- How to automatic update date and time when save custom post type
- Programmatically change post visibility on save_post action return a 500
- Why does wp_update_post causes white screen?
- Update post if exist from PHP
- Odd behaviour for the update button when displaying a WP_List_Table
- How to keep a record of changes to a custom field?
- Updating a custom post status after an expiry date rather than trashing it
- Change the term based on the value of a $variable using wp_update_post in submitting a form
- update flamingo_inbound post type after insert
- save_post affect creation and deletion
- Can I override the permalink/slug on creation
- Custom Post save causes 500 error
- Change custom post status to draft before today
- retrieving external api data and updating existing custom post
- Ordering values entered in Custom Taxonomies
- Page for custom post type
- Getting thumbnails of a custom posts featured images in a page-templates metabox
- can these 3 queries be re-written as 1 query?
- How to update to WordPress 3.6 and not lose my website’s design
- Custom Post Loop pulling all custom posts, not just one
- cannot override post_types in WP_Query()
- Wrapping x posts in html without leaving empty html
- detect when a custom post is cretaed for the first time
- How to customize work area / admin area in a custom post type without plugins?
- Delete a custom post function value
- custom post type archive page has 404 error even though has_archive is true
- Make homepage the newest post of a custom post type
- Add “Select All” to custom taxonomy
- Post loop count is not in order
- How can I merge this function(s) that inserts terms to a custom taxonomy with this other that adds a custom taxonomy filter?
- Custom fields not saving in newest WordPress 3.0.1
- Only show columns in custom post type?
- Filter content in shortcode
- Custom Post Type to replace Woocommerce products – page not found error
- Can’t change posts per page in WordPress Post Type Query
- How to constrain the results to a specific post_type on tag archive page?
- Custom Post Type – Portfolio no longer works
- Showing a meta box in a custom post type on a page
- Having Issue on Getting Metabox Checkbox Value
- Masonry Append WordPress posts with singleMode
- How to create a archive template for custom post type [duplicate]
- add_action ‘init’ from inside a class for custom post types
- Convert Custom Taxonomy Posts to Normal Posts
- Custom menu breaks down
- Pagination for custom post type giving 404 error (but only for news page)
- Exclude auto drafts from listing of custom post type
- How to set post date in post_type so that it’s same as latest post in category
- How to debug failing updates for custom post type?
- Create a post automatically if search result has zero results
- Add two custom product type
- Adding a Custom Post Type
- Urgent – WordPress keeps creating posts
- WordPress shortcode to pull product post data
- How to stop a permalink redirecting to a page whit same slug but different permalink
- ACF field check value of field on all other articles
- Create 3 Levels of relations with WordPress
- Bulk trashing post ‘fails’
- Do not load the categories in Category.php
- Add %post_id% to slug of custom post type and prevent the “unique slug” thing that WP does?
- “A post type mismatch has been detected” Error when updating custom post
- Custom Post didn’t display on tags page
- Linking posts together with Advanced Custom Fields “both ways”
- get_previous_post_link and get_next_post_link of custom post type that share custom field value
- Not able to get all the actions (View, Edit, Quick Edit, Trash), and not able to delete post in custom post type
- How do I resolve obtaining the dashboard features created with CPT UI in localhost onto my live site?
- Automatically assign posts with custom field to taxonomy term
- How do I get the posts from single page custom post type from a sidebar to display in a page?
- Displaying the Taxonomy and a Queried Term on a taxonomy.php page?
- Change Background Color For CPT Template
- Custom post type not being pulled in widget
- Custom post type updated to support comments, yet comments don’t appear
- How to Display CPT Posts on index Page
- Both parent and child articles in archive page
- Shortcodes in custom post fields without the_content()
- Custom Post Type title not populating
- Query posts by a type and another type only if post is in specific category
- Custom post type adding additional markup
- Saving custom metabox data with a twist
- Inserting into WP DB
- Apply custom names for generic custom taxonomy name?
- Rewriting a page driven by custom fields to populate a page dynamically, like posts
- how to pass args for archive.php query?
- How to have a dynamic slug and rendering the archive-{post_type}.php?
- How to get Custom post type by related category ID
- Different CPT permalink base on taxonomy
- How do loop categories post from according in WordPress? is it impossible to solve this problem?
- REQUIRED: The theme uses the register_post_type() function, which is plugin-territory
- Where paramaters of a custom function are coming from inside the loop?
- When Attempting to Filter Plugin Generated Content Using Filter post_type_link, Permalinks Are Not Modified
- Replace the custom post type permalink
- Query custom post type and group by taxonomy
- How to make posts under custom post type not generate a URL / post
- Fix Custom Post Type not appearing in search results?