Maybe try the following:
function set_robotsmeta_default( $post_object ) {
if (!isset($post_object->robotsmeta) || $post_object->robotsmeta == "") {
$post_object->robotsmeta = "noindex,nofollow";
}
return $post_object;
}
add_action( 'the_post', 'set_robotsmeta_default' );
EDIT: Since the above didn’t work, the code below may work, by editing the global $post object before the plugin add_meta_boxes
is called. I just don’t know if this will affect posts that already have that value set.
function set_robotsmeta_default() {
global $post;
if (!isset($post->robotsmeta) || $post->robotsmeta == "") {
$post->robotsmeta = "noindex,nofollow";
}
}
add_action( 'add_meta_boxes', 'set_robotsmeta_default', 1);
Related Posts:
- How often do you need to register_post_type?
- How to register custom post types in a plugin?
- wordpress post_where set only for my costum post type
- Custom Fields as Post Type Options
- Is It Possible To Add Custom Post Type Menu As Another Custom Post Type Sub Menu
- Hook for post and page load
- How to enqueue scripts on custom post add/edit pages?
- How do you use a CPT as the default home page?
- Create a custom archive page for a custom post type in a plugin
- Media library – Limit images to custom post type
- How to Add Custom Taxonomy To Woocommerce Plugin
- Calling a Function After New Post Creation for a WordPress Custom Post Type?
- Development of a WordPress Search Plugin – Best Practices
- Prevent trash/delete action on specific post types
- How to add custom content template part for a custom post type on main query using a plugin
- How to Debug the ‘save_post’ Action?
- Adding a drag and drop re-ordering from a custom post type default list [closed]
- Change capability type of post type registered by plugin
- get_query_var() not working in pre_get_posts
- Unregister post type from child theme
- Filter for “get_post_type_archive_link()”
- How to add a button to custom post type’s posts-page
- How to hook into the CPT’s title placeholder?
- Rewriting ‘rewrite’ slug for custom post type used by plugin
- flush_rewrite_rules on save_post Does Not Work on First Post Save
- echo value from ‘select’ field type into page template using cmb2?
- register_taxonomy with multiple object type and update_count_callback
- Why get_next_post_link() or get_previous_post_link() doesn’t return the required links?
- Admin Post Update Redirection to Posts Screen
- post_type_link filter causes 404 on the CPT page it’s used on
- How to use a dedicated template for the Custom Post Type from a plugin?
- How to create notification on frontend using heartbeat api for multiple custom post types
- How to set a custom post type post as static front page?
- With what hook can I address all posts from all custom post types when they are published?
- Add Capabilities to Custom Post Type after it has been created [duplicate]
- specify meta_key / meta_value condition for prev_post_link and next_post_link
- Include images from pages in wp search.php results in default wp search
- Separating Search Results By Post Type
- List events by month
- Date query for a custom meta field
- Hook when adding or editing a specific custom post type? [closed]
- Maintaining WP_Query Relation Among CPT, Custom Taxonomy, Permalinks- CPT UI
- Twillio How To Send SMS for Custom Post Type
- remove_action conditionally for Custom Post Type
- Change plugin’s has_archive = true to false?
- Getting arguments for register_post_type from a plugin generated post type
- update a post meta from a single table cell TablePress
- update custom post type meta from a shortcode
- Remove POST_TYPE from custom post type permalink
- Query posts between two dates (custom meta keys) CMB2
- How to localize value of posts
- Used with meta_query in query_posts works slowly
- What hook should be used to programmatically create a post only when master post is updated?
- Change upload_dir folder at a certain cpt but cant change back
- How to add post_author column to custom post type
- Creating a function that receives the taxonomy terms that have been changed in a custom post type
- Display custom taxonomy as dropdown list
- Add information above a custom post type listing of all posts page
- How to append element after thumbnail
- Best practice for adding posts in bulk
- Remove “Get Shortlink” button in admin of custom post type
- Hide Meta Boxes for Non-Admins
- Issue to get wp_get_attachment_image with cmb2
- How to have the right design for a custom post type without accessing themes
- Best action hook to create custom post and assign taxonomy terms to it on plugin activation?
- Custom Blog Post Listing in Genesis Sample Child Theme
- Custom Post Type | Fatal Error on register_post_type()
- Set a default category – if the user didn’t select one- before creating a post
- Set object terms not working on plugin activation
- How to add the post ID (or any other post data) to a Contact Form 7 mail?
- Can’t unregister parent theme’s CPT from my child theme
- GravityForm: Populate Dropdown with custom post type [closed]
- Modifying date filter on admin page for custom post type to link to custom field
- how to add extra meta box or textarea into custom post types
- custom post type single page not found after aotumatic publish By the author’s robot
- Accessing download link from the loop with WP Download Manager Pro
- Set a template on a custom post in the plugin
- Simple way to hide\show an announcement (just a div) on homepage?
- Hook create / update post
- Custom Post Type works when registered in functions.php but not when registered in plugin
- Reading Custom Post data so I can have user update Manually
- Why is this function so slow?
- Permalink URL connection between two custom types
- How to show link to product in custom fields?
- Sort custom post archives by a meta value from a different custom post type?
- Taxonomy counter on Taxonomy List(plugin)
- Is it possible to arrange Custom Post Types from CPTUI into a Folder?
- Restrict Custom Post Type to One Item
- Custom Post Type Front Page Gives 404
- Multiple useres editing specified content
- Show Post columns to specific users on condition
- Filter Custom Post Type Posts by Taxonomy
- Add input radio menu to post
- Disable ‘Add New’ in custom post that is made from CPT UI
- Correct way to register custom post type from external php file?
- Insert custom taxonomy into category query
- How to store additional data that is related to core data
- Custom Post Type single post type shown in theme single.php
- CPT UI: Connect a custom post type to a custom post type
- Simple Data picker meta box