You can use the $wp_error argument to return an error message.
$post_id = wp_update_post( $my_post, true );
if ( is_wp_error( $post_id ) ) {
echo $post_id->get_error_message();
}
else {
echo 'true';
}
Related Posts:
- wordpress function to change post status [duplicate]
- bulk post_content update
- Display success message after wp_update_post
- List taxonomy terms for post as checkboxes
- How can I add hyperlink in WP_Error message?
- WP_Error with multiple form validation message
- Get errors from WP_Error to different variables
- WP_Http response throws “Cannot use object of type WP_Error as array”
- plugin generated unexpected output during activation, but it is empty
- “Welcome to WordPress” Plugin Required Error
- I can’t view the orders on the woocomerce dashboard with the brainblocks plugin
- How do I create a state of “don’t assign anything to variable” if WP_Error throws an error?
- wp_update_post function ignores HTML tags
- wp_update_post does not change post status from draft to publish, returns 1
- WP Elementor Pro causing crtical failure on website
- Suitable hook when creating, updating and deleting posts programmatically
- WordPress additional update of publications after importing WP All Import Pro
- How to use classes declared in another plugin?
- Hooking in to plugins
- How can I allow moderated anonymous contributors to post to my blog?
- How to only hook on Single.php after content?
- Handling jQuery Component Collision
- why plugins are loaded prior to pluggables
- Finding WordPress sites using my plugins
- WordPress 4.0 Cookie Authentication to avoid nonce error when publishing a post and page
- Shortcode under a Shortcode Multiple times Possible?
- How can I include PHP-Code to my post?
- Seriously stuck with some custom meta box/plugin stuff
- How to Build a Movie Library in WordPress 3.x
- Intercept comment form submit/list by hook/filter
- How many security plugins are too many? [closed]
- How to add a privacy-checkbox in comment-template?
- Can plugin variables cause conflict?
- Events plugin for theater (event = performance of a production)
- What are the benefit in adding hook in the init() hook?
- Force [wordpress_social_login] shortcode to display where it is embedded [closed]
- How to hide plugin from WordPress Multisite admin plugin list
- Unable to install theme recommended plugins on Multisite
- WordPress URL redirect
- Is it dangerous to install unupdated plugins?
- Getting selected (highlighted) html from the Visual Editor on Edit Post page?
- Accidentally Broke Site (Please Help) [closed]
- How to query the custom fields by language?
- How Do I Figure Out What File(s) to Edit from Looking at the Source Code [closed]
- Any recommendation on how to manage ads?
- Plugins not showing in Multisite dashboard
- How to create an archive page (with links) for a date range?
- Change permalinks of custom post type ‘question’ as post id or any random number once
- Why Is This Code Causing The Admin Bar to Disappear?
- WordPress stripping away backslashes from HTML
- Displaying Custom Sidebar Without Modifying Theme’s Core File?
- Plugin for users to create their own ads like Google Adsence
- Is there a PressThis that doesn’t hotlink?
- bbPress plugin: forum lists not showing in correct order? [closed]
- WordPress stats API key
- How do I find out what is in control over a certain part of a website?
- Anyway to convert a plugin to become a shortcode?
- ‘Organize Series Plugin’ as muti author feature
- Suggestions for Dressing up blog for the holidays
- How to automatically add edit link on frontpage post of any wordpress theme?
- Allow only Admin role to access plugin settings/options page
- Use different single.php file based on condition
- Change the style of h1, h2, only in post entry
- How to reset the plugins without deactivate the plugin
- Elementor page builder plugin not loading up all the way? [closed]
- show my own admin_notices after a post has been published
- Play videos with buffering in my server
- Custom form not showing in correct place on page
- Dropdown menu on click change
- Editable select options in quick edit OR in plugin settings
- Send Array from JS to php file then insert it in wp database through a plugin
- How to add the search page link to the anchor tag?
- How to override Plugin javascript function : $(‘body’).on(‘change’,’.class’)
- Connect / Login WordPress Hosted Website or Blog with NodeJs
- Possible way of having multiple Gutenberg instances for a page?
- insert data from textbox to database
- Plugin updates, change file permissions on WordPress
- Creating one user access account for all the multiple sites
- I am Getting Sorry, no posts matched your criteria on form submit only for certain page [duplicate]
- Plugin information tabs show large blank area at top
- Dynamic input fields in WordPress Plugin
- Custom role not listed
- How to fix blog article view and share #’s?
- How to Prevent User From Submitting Property Or View His Posted Properties Before Login in wordpress?
- WordPress SSO SAML
- Attachments plugin cannot click media library button [closed]
- Is there any hook to change media html in post? [duplicate]
- plugins_loaded action is not working properly
- Creating a user ‘add custom field’ section
- WordPress Settings – Custom Button actions
- After installing plugins, changes don’t appear
- Links on FAQ page aren’t working
- How can I make the Twitter Tools plugin hyperlink every link?
- wp insert post not working
- WordPress shortcode plugin not working
- FacetWP: Plugin breaks button/modal functionality inside searchable content area
- WordPress error Fatal error: Uncaught TypeError: Argument 3 passed to Automattic :get_setting_for_feature() [closed]
- Form with response button after on table after submission
- Fatal error in wordpress
- Conclude woocommerce-shipping-totals