you may add a filter on wp_insert_post_data
:
add_filter( 'wp_insert_post_data', 'my_force_publish_post', 10, 2 );
function my_force_publish_post( $data, $postarr ) {
if ( ! isset($postarr['ID']) || ! $postarr['ID'] ) return $data;
if ( $postarr['post_type'] !== 'inventory' ) return $data;
$old = get_post( $postarr['ID'] ); // the post before update
if( $old->post_status !== 'draft' ) {
// force a post to be set as published
$data['post_status'] = 'publish'
}
return $data;
}
Related Posts:
- Disable “preview changes” button
- Visual Studio SignTool.exe Not Found
- How can I set a draft page as parent without publishing?
- Display a post’s publish date from 2112
- Does blocking xmlrpc.php affect pinging update services like pingomatic
- I can’t preview post’s change once they are published
- How to show an error message after publishing a post?
- How to display and use all existing tags at my write-post-at-frontend-panel?
- How to make scheduled post preview visible to anyone?
- Scheduled Posts and wp-cron – Why don’t scheduled posts publish if too old?
- Why does publish_{custom-post-type} fire on update?
- Show recent published posts
- Is there a way to know if a post has been published through XML-RPC?
- How to unpublish a page and still keep a draft?
- get_terms on save_post hook
- Save and Publish button not working after installing SSL
- How can I automatically set a post slug based on the post title during post publish?
- Can we have private drafts?
- Update post meta on bulk edit / update
- Can’t schedule post for another time
- publish_post called too early
- Custom save button shows ‘Are you sure you want to…’ dialog
- Get publish post link?
- Controlled publishing in WordPress
- Change the text of the publish button to Save
- problem with publish date not always appearing [duplicate]
- What is happening to make my Update/Publish button disabled?
- What is the reason for the new_to_publish hook not working?
- After I publish a post where does it go
- Should you manually ping new WordPress posts?
- Authors should not publish
- How to add custom status to quick edit
- I need to modify drafts using custom data from database and then publish it
- How to show or hide a post based on meta_value selection?
- i am making text changes on my page show in preview not on live site, why? [closed]
- Is WordPress “publish” atomic?
- How to move post process to background
- How does redirect work when publish date changes and date in url changes?
- Gutenberg publish date datepicker
- How Google Indexer should only index published pages
- Publish and go to page [duplicate]
- Publish Post Action Not Working
- Is it normal for a scheduled post to say “Missed Schedule”
- Manage multiple wordpress installs (Best Practice)
- Showing the next post’s title, even if it’s an unpublished post
- Force Publish Future (Scheduled) Posts Immediately [duplicate]
- Can’t publish posts, Jetpack won’t connect, empty notification emails to my inbox [closed]
- Duplicate post on publish
- How is it possible to use a very reduced version of WordPress?
- Problems in updating a self-developed plugin
- How can I put a custom meta box above the editor but below the title section on the edit post page?
- Unable to select an old date in wordpress
- How to add editor’s name to entry meta byline?
- What are the better WYSIWYG post editor replacement alternatives?
- Action on post publish
- Should the WP post editor B (bold) button be inserting a tag instead of in HTML5?
- Editing a Post, 99% CPU?
- Can I set a timer for pages to be published?
- How to rename “Publish” metabox title in post screen
- Auto Publish On Cron
- How to add Sidebar and Full width option in post editor
- Adding a tooltip above Categories postbox in Post Editor
- publish_post action hook not working
- Changing wordpress publication date to ACF date and time picker date not working
- Decide user that can publish a post
- How to allow users to post only in certain category and hide elements from edit page?
- Add default page editor to an admin settings page
- Show Author information on post page on dashboard
- Do action for only switch status for publish_post
- Setting dirty on customizer
- Display password protected posts to logged in users
- WordPress publish_post hook not getting featured image and meta on first publish, but works on updating title
- find out reason of “Updating failed” in Post-editor
- Prevent all users from editing posts except admins using hooks
- Post: how to set created date after post has been published [closed]
- I am getting “0” in the starting of my post description at home page
- Automatically add a character to field in edit post page
- Publish box in CPT remove ‘edit’ link
- how to move a plugin-block in Edit Post page back to bottom area?
- Wrap post images with a link, not figure (image_send_to_editor doesn’t work)
- Why isn’t update_post_meta saving?
- If click on Save/Publish change Post Status to Pending Review instead Publish
- How can I (for the long term) style the classic editor’s TEXTAREA?
- how can i add extra parameter to edit post link?
- Using get_the_excerpt in edit-post
- Create a new post on a specified publish date via link?
- suffix title with “EXPIRED” when scheduled post has reached it’s published date
- How to remove UI access to Custom Post Type using direct links?
- display wordpress user who published a pending post of another user
- Firing page_publish where page is child page
- problem with blank page
- Empty paragraphs around figure and figcaption tags when using markdown
- Change event firing in wordpress
- I want my post to republish again after adding a custom field
- Check if there is an post to be published in future
- Edit the Publish Widget Options
- Split post edit screen into sub-edit screens for users, is this good or bad, and is it possible?
- Plugin SVN folder structure
- Return All Post from publish to draft [duplicate]
- How to retain last modification date on draft edit