Not sure about the problem with wp_update_post
but it is a simple enough SQL query:
global $wpdb;
$query = "UPDATE ".$wpdb->prefix."posts SET post_status="draft" WHERE ID = '".$directory->ID."'";
$wpdb->query($query);
Related Posts:
- $wpdb->update() always need a second try
- Bulk post approval and publishing doesn’t work
- No Error Log File, no debug info
- Load js/css files only on specific admin UI pages
- How to Change the Entire WordPress Admin panel Look and Feel?
- Prevent notice and warnings in error_reporting?
- WordPress and multithreading
- how to use thickbox in admin?
- Nonce in settings API with tabbed navigation
- How does WordPress treat rewrite rules “under the hood”?
- Add rewrite rule in plugin: with .htaccess in plugin folder or using WordPress functions
- Using preg_replace to clean widget output HTML
- Removing rules from .htaccess
- What is the best way to provide plugin users with a way to customized the styles
- Mapping multiple URLs to same page
- Add Products to Woocommerce through WP API
- How do I only load js on the post-new.php and post.php pages in admin?
- Check if on Custom Post Type for TinyMCE buttons
- Screenshot are not showing up on plugin page
- How to not let a user with a new role edit users that have administrator role?
- Modifying values with add_action to be sent to db
- Options API – Validation Callback $input is NULL
- how to use preg_replace for wordpress video?
- async code or cron job?
- Configuring WordPress Auth Cookie Expiration
- How to display a message about updates in the plugin list
- How to save WP widget instances and options
- Function Get User Object By Username?
- How to run an add_action hook for specific page
- Loading jQuery and jQuery plugin script files correctly [duplicate]
- How to use radio buttons in WordPress plugin options using register settings?
- WordPress not working on localhost
- manage_posts_custom_column, showing serial number using increment in loop
- Custom delete option button in plugin settings
- SQL query for custom taxonomy slugs
- What should happen when a WordPress Plugin is activated across the network (Network Wide Activation)
- Send push when new post is published in a certain category
- How can we display product price $104 on the cart while the credit card payment method is checked?
- Storing data in wordpress database from ajax call from different website
- Prevent invalid or empty values from being saved to the database and retain the form field values upon error
- Translation per IP location [closed]
- Add a select option of shortcodes like dropdown in tinymce
- Hide shortcodes “code” when using the “editor” the same as wordpress do with “gallery”
- wp E-commerce featured product plugin with muliple option?
- How to test a WordPress plugin in real time
- How to Trigger WP CRON at Local Timestamp?
- Problem with saving checkbox values with WordPress Widget API
- How to Control CSS of Admin On Creating only a Specific Custom Post Type
- How to get a list of child ids for a named category?
- Plugin could not be activated because it triggered a fatal error, unexpected ‘[‘
- Show dynamic list of products from custom api of another database under same host
- Hide custom post type by user roles
- How to make the first commit on WordPress.org
- Using OOP inside a Plugin – Is it allowed?
- why isn’t require_once working with my path names
- Odd map_meta_cap $args on post edit — sometimes integer, sometimes string
- How can I create a custom plugin that allows anonymous users to signup without registering?
- How best to handle database version dependence (from $wp_db_version)
- Associate multiple email addresses with the same user account, so they can log in with either
- How to grab query string from wp-content/uploads/.*
- How to call a function using a shortcode [closed]
- How to add template colors to custom block options in WordPress Gutenberg editor sidebar?
- WP: Search and replace in DB programmatically
- Update a user profile via frontend
- What is the way to hook all wordpress email
- Configure WordPress to Generate Scheme-less Relative URLs
- Best way to distribute templates and code accross multiple wordpress sites?
- Get images / media attached to a page by page ID
- How to create two custom post types when plugin is activated?
- Plugin architecture to pull from API & create dynamic content on WP site?
- WordPress templating system for custom plugins
- Lead form that submits to 2 external APIs
- Modify code for functions.php with specific twitter user url and hashtags
- Why is $_POST empty when saving custom Meta Box?
- How to remove dynamic-css
- Wp_List_Table is showing as no class found named wp list table
- Where to save Gutenberg plugin data?
- WordPress Jquery with heade and footer sritp plugin
- I cant add is_admin control to plugin
- woocommerce wc_get_product is not fetching all the product of particular category
- Integrating colorpicker into array field
- Add new header/footer on landing page with plugin
- Redirect with message after admin_post.php
- Add function to Dokan ajax class
- Plugin MySQL SELECT custom data and filter on user meta
- redux framework: add custom css to the output css
- Multi hook deploiement
- Why Worpdress doesn’t create table in database?
- Form and database, plugin development
- Endpoint Callback Display for Custom Plugin
- Get Commentor IP When Marking Comment As Spam
- What is the use of wp_schedule_event hook?
- Why if i enqueue the tinymce script i get undefined error
- How to show custom taxonomy child posts through shortcode in WordPress
- Best practice to include custom user styles in widgets
- Very Quick Custom Pluggable Function Question
- Combo/Drop down box on plugin settings page that allows additional options to be added
- Sending Parameter Failed
- Checking if the query is empty does not work
- I want to redirect user to an amazon product page from my wordpress website when they add product to there cart [closed]