Try
function wpse46583_save($post_id,$post) {
// verify this is not an auto save routine.
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return;
//You should check nonces and permissions here
if ( !current_user_can( 'edit_page', $post_id )
return;
//Get category slugs associated with post
$cats =get_the_category($post_id);
if(empty($cats)){
//No category assigned - do something here.
}
return;
}
add_action('save_post','wpse46583_save',10,2);
Related Posts:
- Difference Between Filter and Action Hooks?
- How can you check if you are in a particular page in the WP Admin section? For example how can I check if I am in the Users > Your Profile page?
- How to create an API for my plugin?
- How to store username and password to API in wordpress option DB?
- Is there a limit on making calls to WordPress.org API’s?
- Using filters and actions for plugin API?
- WordPress and multithreading
- permalinks with get variables
- Build dynamic page from cURL (HTML page) response with plugin
- How to override a function call in functions.php?
- wp_enqueue_style built in styles
- Should I ask my Twitter plugin users to create their own Twitter App and API Keys to use my plugin?
- Does WordPress’s HTTP API use any caching?
- Example Dashboard Widget, Cancel not working
- Amending REST API function without deactivate/activate plugin every time changes is made
- Why does wp_remote_post returns an empty body response on certain endpoints?
- Adding custom end points, No error line
- Sending post request with wp_remote_post not working correctly
- woocommerce_checkout_order_processed hook executing function twice
- Encoding Method for URLs?
- Google credentials and redirect URI for Google OAuth2 in a WordPress plugin, questions
- Plugin index page code executes multiple times
- Pass CF7 form data to plugin
- Best way to ping for the API changes in the wordpress?
- Plugin architecture to pull from API & create dynamic content on WP site?
- Lead form that submits to 2 external APIs
- Widget internal hooks and functions
- Allow REST API Endpoint to specific user and hide from public
- Custom Endpoint – Does it possible to use PUT method with WP API Rest?
- Get API auth_token token to renew weekly
- How to query a nested field in wordpress api using _fields param
- call funcution when clicking submit
- Adding Amchart Interface to WordPress API
- How do I make secure API calls from my WordPress plugin?
- Generate Static Page to Show Search Results/Detail for API
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- Hiding WordPress REST endpoints from public viewing using Basic Authentication
- add pagination to wp_remote_get
- Multisite and the JSON REST API: How to?
- How do WordPress plugins work with oAuth2 APIs?
- API WordPress is Limited? Return False
- Tie specific functions to options-update for limiting API requests
- Do you see any problems (mainly security-related) with how I’ve used wp_ajax_* actions?
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Can a plugin differentiate syndication feeds from actual site views?
- Developing a plugin, ran it through P3 Profiler, shows up slow, but I don’t know why
- add_rewrite_rule not working
- How do I query posts and have their related taxonomies returned in the results?
- modify buddpress adminbar only in admin pages
- How to update WordPress Plugins in your own maintance application?
- Programmatically creating posts based on external JSON feed (asynchronously)
- External api call using wordpress
- WordPress getting data from external API
- how to send csv file to other server using wp_remote_post?
- How do I return XML to an API post request
- Standard location for plugin to save/cache files?
- Releasing new plugin version, how to rename old options keys?
- Register custom query args parameter for WP_Query()
- How to remove unwanted panels inside InspectorControls from core blocks in Gutenberg
- What is the best way to do unit tests for your plugin in 2018 [closed]
- Hourly WP schedule, do I need at least 1 visitor hourly?
- wp_query (and post_id) is empty in admin_init
- Why is my shortcode not working
- Creating option to allow user to select the page my plugin content will display on
- Can I differentiate between “Delete Post Permanently” and “Empty Trash” and do something for each accordingly?
- Use php libarary in wordpress plugins
- Can’t get JS code to work with shortcode
- Plugin options page – form with two different submit buttons
- Show Parent category and Subcategory
- Frontend Ajax call not working using wp_ajax, wp_enqueue_script and wp_localize_script
- best practice for query string values – get_query_var always empty for my value supplied in query string
- update post meta for checkbox in the admin when inserted in the front-end
- Gutenberg Block showing invalid content on edit
- How to implement filesystem cache in WordPress
- Check for template part, else filter content
- what are the checksums surrounding keywords in the SQL generated by WP_Query and do I need to use them too?
- Is it possible to make sure that only my plugins output is shown to the enduser?
- Plugin generated virtual pages
- add javascript files only when plugin is called?
- wp_dropdown_roles() to replace option value = code
- plugin_dir_path wrong url
- Return Value of load_plugin_textdomain
- Special Formatting for WordPress Plugin Description?
- custom wp_editor does not save the content in plugin settings
- Change the behaviour of a button
- Login page too many redirects
- Progress bar in plugin within admin
- Jquery php request is returning a weird result
- WordPress admin panel not working
- Load script on frontend from widget plugin
- Can’t get wpColorPicker to work in a widget
- Ajax functionality not being called under wordpress plugin
- Add a description/hint field in the admin page of a plugin
- Saving multiple fields as array
- Serialized Data
- I don’t understand how symlinks in plugin work
- Undo operation not working in Rich text [Gutenberg]
- Reinitiate Gutenburg’s blocks using javascript
- Generating Multiple Divi Pages from Database
- Custom Gutenberg Block ‘Stylized List’ – Incorrect Rendering and Looping of List Items