The ID of the post if the post is successfully updated in the
database. Otherwise returns 0.
So just test again that.
if ( $post_id != 0 ) { // success!
write_here_show_success_messages();
}
Or you can use an action.
<?php
/** use action for success message **/
if ( $post_id != 0 ) { // success!
add_action('form_message', 'write_here_show_success_messages' );
}
?>
<div>
<?php do_action('form_message'); ?>
<form>
<!-- form contents -->
</form>
</div>
Related Posts:
- wordpress function to change post status [duplicate]
- bulk post_content update
- How to check if wp_update_post was successful
- List taxonomy terms for post as checkboxes
- wp_update_post function ignores HTML tags
- wp_update_post does not change post status from draft to publish, returns 1
- Suitable hook when creating, updating and deleting posts programmatically
- WordPress additional update of publications after importing WP All Import Pro
- How To Activate Plugins via Code?
- dbDelta only creates the last table
- Facebook comments box on front page
- Changing Woocommerce Product Description [closed]
- Where should my plugin POST to?
- How would implement StackExchange ‘Questions with similar titles’ for the FAQ on my wordpress site
- Plugins error (Use roles and capabilities instead) on latest version, multisite
- Alternative default avatar generator?
- Plugin form unable to process
- Meteor Slides as header only for homepage and Use featured image of each page as header for respective pages
- Plugin to install a plugin
- Plugin set default setting value when it activated
- Get all options saved by another plugin
- I need some direction on how to have a sidebar based on meta rather than page
- Add Image to the RSS plugin reader from another RSS [closed]
- Improving a Stackoverflow “inspired” badge system to display badges in author page
- Override plugin with functions.php
- Get the url of the full sized attachment image using post ID?
- Set the active Navigation Menu from a plugin
- What is the best way to mimic a search query within a plugin
- Programatically download a plugin
- WordPress Registration Email by Role
- Modify the file inside plugin dir – the right way
- Creating plugin using simple_html_dom parser?
- custom changes removed after plugin update
- wp_set_auth_cookie causes 403 error in the wooCommerce checkout
- wp_schedule_single_event not working: cron job is triggered but nothing gets executed
- wp.media javascript issue with on select
- Finding the URL to be used to check if plugin is installed with a theme
- Creating shortcodes in plugin
- Using arbitrary paths in page urls
- WooCommerce search products between price range using WP_Query
- Stop WordPress processing Javascript as text
- Meta box losing its value when scheduled post is published
- Full list of registered scripts or styles, but from an admin options page
- Why is the ‘Gutenberg’ Plugin generating an ‘Inconsistent File Permissions’ error when other Plugins, with the same permissions, do not?
- Disable Plugin with one button
- Exact Hook to payment methods
- Using wordpress translations strings in plugin
- Are mu-plugins plugins still deployed via wordpress.org/plugins?
- How to make my blog available to other website using RSS feed?
- how to insert a HTML form into a javascript popup?
- How can I modify page content in the admin panel?
- WordPress programming video tutorials [closed]
- WordPress front end AJAX. Return 0 :?
- get specific value of a array | PHP
- Displaying content based on drop-down menu selection sitewide
- DB Query not working in Plugin
- sending different email notification while registration based on user role
- WordPress Multi-Step Product Search
- Woocommerce Free shipping method [closed]
- How to save comment name email url fields?
- WordPress Post HTML after Posting
- How to append new form elements in “Add New” form of Users in WordPress admin panel?
- Settings options not showing up on Sub Menu page in WordPress plugin
- Using Amazon Book Gallery Plugins in WordPress [closed]
- Custom Meta box change size
- Could add_query_arg() redirect user to external site?
- The Build menu theme is frozen with the wordpress theme
- How to add label/badge on bookable product based on their booking status
- Does anyone know why my SEO and title become one?
- WordPress PWA with Form
- Help to create function that changes name in the certificate of the sensei lms
- Get Shortcode output to database for static post_content
- After migrating with duplicator all scripts are still tied to old CDN
- How to prevent redoing get_posts queries and make results available to other scripts?
- strtotime not working
- Prefix WordPress Taxonomy Tags With Hashtag Symbol Like Twitter
- Optimized PHP & WordPress settings for speed/performance?
- Speeding up WordPress on a Local Network
- How to add php plugin code in theme
- how change my menu on submenu
- ound this in Where to edit Custom Content fields to optional if there is no plug in?
- How to add a meaningful link in plugin admin panel?
- How to set up php,javascript and css to allow for our finished product to be displayed within a page?
- jQuery loaded in wrong order for non-admin page views only
- Adding custom cron_schedule prior to wp_schedule_event
- Capturing POST data
- Advanced Custom Fields Plugin – not displaying images
- why i cannot see some plugins while they are enabled on network admin page?
- wordpress Search function is not working
- Auto play audio using WP Maintenance Mode Plugin [closed]
- Plugin to allow for recurrent subscription + exclusive content
- SSL not working for checkout
- Plugin LDAP Authentication 2 In stallation ploblem
- woocommerce how to get cat id in content-product.php
- How to use WP-reCAPTCHA on a form
- Why is my menu page not being displayed?
- stop resize button for wordpress media
- Mixed results with is_page() WordPress function, when using $this, or self
- I have created a custom plugin. After activation it creating page but i am not getting how to add another php file at page content?
- HTML output from WordPress shortcode is wrapped in unexpected tags