You could for example save an error flag to a transient in save_post
, if a required field is empty, and the display the admin notice based on the transient. This concept is demonstrated in in this old answer.
Another option is to add a simple script to the editing view which would alert the user that the said field is empty. Or just add required
html attribute to the input field.
Related Posts:
- Wp_update_post: Infinite loop even with remove_action solution, OOP
- trigger save_post event programmatically
- Is it possible to save/modify a post without calling the “save_post” action hook?
- Returning ACF custom field from publish_post
- How to check what kind of saving it is?
- Firing a function AFTER redirect
- How to catch and modify custom field values when a page is updated
- How to change image atributes right before an image to be saved?
- Conditional for autosave or auto draft?
- save_post hook to add terms getting deleted when using bulk edit
- ‘save_post’ hook not working in WP 3.5
- Block Update Profile Errors
- Add action save post when create and publish
- remove_action(‘save_post’) in function that was triggered by save post not working
- Problem with call_user_func_array front end
- set_post_format called after wp_update_post when using bulk edit?
- WordPress save_post hook not firing when checking if _GET[‘post’] is set
- Which hook should I use for this scenario regarding the registration process and account/profile update?
- How to use the password_reset hook to validate new password and display error
- How do I set a custom post type Category after import using wp_set_post_terms
- WooCommerce: change display order of product short description and price [closed]
- Is there a WordPress core & plugins update action hook?
- is it possible to get the hook name in add_action?
- What hook is executed just after wp_query has been executed?
- How to properly test a method that is called by an action hook
- How can I do customizations on login, registration and password recovery forms?
- Custom form action hook
- Hook before inserting user into database [duplicate]
- How to send an automated user ‘inactivity’ email?
- How do I successfully create a hook for an email override?
- Placement of Code in Plugin for hooking `save_post`
- Cast string to number
- How to debug user_register hook
- Storing state between hook functions
- What’s the difference between “wp” and “wp_loaded”?
- WordPress capabilities and restricted categories access
- How to use custom form on add_meta_boxes callback
- Is it possible to switch Gutenberg’s editor styles when document settings change?
- Updating post data on save (save_post vs wp_insert_post_data)
- schedule event in class oriented plugin
- How can I find the hook I need to rewrite a function?
- Show message in media-new.php
- Hooks are not being removed in child theme
- Stop saving process when metabox is invalid [duplicate]
- add_action second argument missing
- Bug: Post needs to be updated twice when adding action for save_post hook
- How to get user meta fields that have just been updated?
- admin_notices action doesn’t trigger within save_post action
- When a plugin gets updated from the repo, does the “activation” hook fire again?
- “admin_enqueue_scripts” hook or $_GET[‘page’]?
- Defining hooks within (php)classes?
- Divi hook not working [closed]
- Add WordPress hook outside of Plugin or Theme
- How to perform action when plugin/theme editor is used?
- How to run hooks one by one manually?
- Action hook save_post for newly created posts – $post object data is all empty
- What is the proper hook to use for recording a post view?
- How to load this code on function.php
- Woocommerce single_product_summary hook not working
- Where is publish_post hook fired?
- A good hook to check authorization and redirect?
- Bloginfo hook – can it be more precise?
- Custom posts and get_post_meta in {$post_status}_{$post_type}
- Hooking custom PHP output into WP: how to do it, parse_request almost works but not quite
- Print on screen during shutdown hook – error during saving in theme-editor.php
- change wordpress pagination url after doing the request
- How to stop execution of a function via add_action hook?
- changing genesis_before_while in new theme framework
- Moving Javascript from footer to header
- Adding a new hidden field based on a condition in Ninja Forms
- Forcing WooCommerce customers to create account before checking out
- Store user ID on wp_term_taxonomy when new term inserted
- ‘user_register’ hook – need to distinguish if created from wp admin panel
- Make multiple URLs behave as home page
- Issue migrating a checkbox-type meta field to the block editor
- Transition_Post_Status hook not working properly
- Wodpress XML Import hooks
- profile_update hook does not fire from front-end
- wp_update_post not getting triggered by hook
- How to get user profile information before update?
- Why is pre_get_posts hook invoked multiple times?
- Undefined fieldId in gform.addFilter for limiting dates in datepicker – Gravity Forms
- Get First Post content and edit it using pre_get_posts (or similar?!)
- Are there Hooks for featured image popup?
- WordPress sending data with add_action
- How to hide / remove attachment “alt” or “caption” field in Admin?
- Why does get_post() not return anything?
- Hourly events don’t get triggered
- Access post meta just after publishing
- Which hook runs first(init,… or ???) [duplicate]
- Redirect back to origin page after using get_delete_post_link()
- Is there any Reference of WordPress hook and hacks? [closed]
- Thesis Theme -> hooks not working for custom function
- Can I display text that’s generated by a hook in another place in the HTML?
- Removing script tags that are loaded by other script tag
- Does wp_login hook fire on user registration?
- wp_trash_post not firing as expected (also applies to trashed_post)
- How can I get the ID before after_setup_theme?
- Prefix user login_name and validate it is unique on Registration
- Why does my function create extra empty files?