In your functions.php
:
add_action('publish_post', 'check_user_publish', 10, 2);
function check_user_publish ($post_id, $post) {
if($post_id == 1){
$query = array(
'ID' => $post_id,
'post_status' => 'draft',
);
wp_update_post( $query, true );
}
}
Related Posts:
- Action hook for new pending posts?
- Hide a specific category in admin All Posts page (WordPress)
- Updating post data on save (save_post vs wp_insert_post_data)
- Adding bootstrap classes to video shortcodes
- fire action when post is being edited as well as saved?
- save_post not working
- transition_post_status hook, works – but not if the post is new
- How to detect single.php (but not single-portfolio.php)?
- Get old values for post before saving new ones
- Execute function when post is published
- how to limit edit_form_after_title hook to page and post edit only?
- disable WP automatically inserted line breaks after an image
- Listen to Post action
- Customizing subject in comment notification e-mails
- Getting the post_id in wp_ajax function
- delete post also attachments
- How to call function within a page/post, to dynamically generate content?
- Restrict users from editing post based on the age of the post
- Count singular post views automatically
- List only child categories a post is in, of a specific parent category
- Hiding by default specific post status on backend list?
- Filter post before *editing*
- prevent showing posts of an specific category in admin posts section
- How to display post tags
- Custom function for “Submit for Review” hook
- Allow role to delete posts but block him the wp-admin
- Fatal error: Class not found in
- Why does `url_to_postid` return 0 when testing `page_for_posts` Page?
- Custom Post Status Posts viewable to the public
- WP_Query in functions.php overrides global $post object, even with wp_reset_query()
- How can I list random authors from current post category?
- add filter to “quick edit menu” in wordpress admin
- Disable single post page
- Enabling post thumbnails for custom post type
- What differences are there between a Privately Published post and a Draft post?
- Global $post not working in OOP function WordPress
- WordPress after content Hook & external template part
- Update post status from “publish” to “trash” for half of posts
- Prepend or add an Image to the content of a Post
- how to remove dash (-) post status from post title on posts listing page wordpress
- Adding option to Gallery shortcode
- Which WordPress hook fires after post content loaded?
- How to display the link (title) and thumbnail post?
- How to access $post from a callback function
- How to do set post permalinks using 6 digit random unique function?
- Admin – create custom post status and display above table
- Display post x of y within category
- WordPress capabilities on pending post status
- Call Web Services on post first publish
- What happens if I delete all the rows that represents a post revision from the posts table into WordPress database?
- $post->post_type not working
- disable Tab post on nav-menus page (Admin)
- how can i allow users to view their own pending posts in a front-end page
- What does WordPress do if I save a post without content/title? [duplicate]
- Every second post different class in blog view
- preg_replace not removed “class”
- Get post meta retrieving wrong value
- The_excerpt() doesn’t parse – how to change that?
- Divs appearing everywhere in post content
- Add custom text automatically on each post
- Un-highlight Blog Menu Item when Category Menu Item is Selected
- Is it advisable to use $post->comment_count instead of get_comments_number( $post_id )
- Stop post submission without losing data?
- Cant’ Grab WordPress Built-in Posts Through Loop
- Same post appears in related Posts?
- search content of pages and list in wp-admin
- Help on conditional statement to accompany wp_insert_post function please?
- Creating posts with links from a txt file
- Show Last Revision Of Post That Has A Published Status On Single Page
- how to show comments only author which send own posts in wordpress
- get category in list of posts // shortcode for custom related posts
- Posting to WP via URL
- Alt text attributes not showing over portfolio images
- The function called on the wp head hook becomes null
- Get Category in save_post Hook
- Set a post expiration and delete a post when expirate
- Count singular post views automatically
- How publish post from pending status
- I want to change the WordPress comments file
- Replace Tag Keyword With Link Within Post Content
- Changing a users posts to drafts upon role change
- Get post id outside loop : Notice: Trying to get property of non-object
- How do I change the post title’s link on the posts page?
- plugin not hooking to my custom hook
- im trying make a function to auto correct posts when i open the posts in the backoffice
- How to change number of posts shown on homepage vs other pages?
- Template file structure , wordpress hook for altering the template
- Show only top 3 posts from 3 categories in order on home page
- How to get posts from network blog
- Get post title by Alphabet
- How can I create a menu items from meta box based on users input
- How to use wp_editor(); in functions.php then retrieve content in the template
- How *not* to show the last post on the latest posts list
- wp trim function not working
- Insert Shortcode exactly at the end of the content
- display last post modified date in genesis child themes
- Custom Post-Rename Function Does Not Function in WordPress 6.x
- How do I save JS classes being applied to the WP dashboard via custom plugin?
- Admin notice on wp_insert_post
- How to sort posts alphabetically based on a specific parent category