Something like this?
// You'll want to programmatically get the post ID
$post_id = 1;
// Get the posts' content
$post_content = get_the_content(null, false, $post_id);
// Using stripos() is case-insensitive to check for your phrase
if(stripos($post_content, 'specific words') !== false) {
// Sets the post's status back to "draft"
wp_update_post(array(
'ID' => $post_id,
'post_status' => 'draft'
));
}
Related Posts:
- Fatal error: Call to undefined function mysql_connect()
- Pass a PHP variable to another file
- How Attackers write script into my php files?
- Fatal error: Call to undefined function plugin_dir_path()
- Switching wp_get_sites to get_sites
- How to get author ID when an author page is being viewed?
- Modify image while uploading
- Using Global Variables Expensive for PHP
- One button to change all settings in theme customizer?
- How to remove html comment from source?
- Add custom image sizes to media uploader
- Need help on WordPress and php
- Looking to exclude blog posts from category Previous/Next buttons
- How php content after the first and second paragraph
- Automatic Excerpt Not Working
- Best way to create a user programatically
- How to resolve error “Cookies are blocked due to unexpected output.”?
- Can’t use get_results() in ajax query
- Is $hook a global variable in WordPress
- Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- Remove all nav menu classes ( but keep useful ones… )
- Convert imploded plain text into links
- How do I turn a shortcode into PHP code?
- WordPress get pagination on wpdb get_results
- PHP if Condition not working
- Can I change the contents of a description meta tag generated by Yoast?
- How to filter/hook-into retrieve_password() to filter $_POST[‘user_login’]?
- Sorting Posts | Alphabetical Order
- How to return a foreach inside a shortcode
- Shortcode content output but not in correct place
- How to get the Page Number of the Current Page in Single Post Pagination
- Handling Body class based on Template
- Storing Array from returned database query and using the array in a new query
- Mass update excerpt
- PHP variable = get_the_post_thumbnail_url outputting without slashes
- Automatically adding new post categories to menu
- Show prices with tax in Woocommerce Mini Cart [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- Get post id in a function when edit/add a post
- Reconfiguring WordPress site
- WordPress every page is 404 not found including admin resources
- get author_name from queried post
- get_template_part based upon post’s category
- How to split links generated into an xml sitemap to avoid exceeding 30 sec maximum execution time?
- Query if audio attachment AND/OR custom field
- Database query works fine outside WordPress
- post thumbnail, conditions, else wont work
- How to solve Woocommerce Memory Limit
- Shortcode to find and replace URL
- PHP in Edit Post link
- How to add drag and drop functionalities to a div inside option panel
- Function Reference Documenting Template Tags for use in Custom Theme Templates?
- Seo Friendly Filter URLs
- entire JS folder not loading in a WP theme
- Add new post in existing categories using wp_insert_post
- I’m unable to call img path using single quotes in an array?
- Split shortcodes to array of shortcodes
- Else/If Statement to Display Photo Descriptions
- Correct code to use php in text widget
- How to correctly load a different version of main menu based on the user language in WordPress? Is it a good solution?
- custom header text
- Dynamic menu with custom post types
- Too many errors on log
- WordPress single.php get_header not working
- Load more posts using AJAX based on posts inside WP_Query
- Undefined array key 0 wp-includes/capabilities.php on line 76
- I want to fusion the product columns in email table order
- Store GA Client ID in User DB
- Hide author from search results meta, still display date and categories
- Using wp_editor() when not logged stopped working
- Why does a header location on admin_head remove the query var I’m setting in the location?
- A WordPress Page to display custom database query results
- Get all woocommerce product names with price and show using core php
- Is there a way to search for a missing endif?
- How to call WordPress PHP file using external js file
- Site doesnt work once PHP changed to 7.1
- Changing WordPress author name in database
- admin uploads pre_get_posts not working as expected
- can’t delete a row from post_meta table
- PHP: Why does my code work in index.php but not a widget?
- Run PHP Results inside WP Shortcode
- Not able to get the exact URL of the file on server located in active wordpress theme
- How can I remove these resize lines from the comment box?
- Change taxonomy for categories
- Accessing Variables Used In a Plugin Using PHPStorm + XDebug
- Insert wordpress tags below posts via functions.php
- Show Nav Link To Users Signed In
- WordPress $GLOBALS and PHP $GLOBALS
- How to echo a different field if another field is empty?
- Remove the_content From Loop
- Add multiple JavaScript files to template header [duplicate]
- Load a Header in wordpress
- Trouble figuring out how to get my button to submit comment
- How to insert a variable into a query parameter?
- Find owner of coupon
- WordPress wp_remote_request() – How to do async await in wordpress php?
- How Create Automatically Image jpg.webp from image .jpg without delete or change original images upload
- Need help with conditional logic for menus
- Disabling User Email Notifications for Erase Personal Data Utility
- Facing Problem While Running WordPress Hook For Archive, Categories, Author, Date Pages Only