Return to Snippet

Revision: 54111
at December 10, 2011 06:07 by briteweb


Initial Code
global $post;

//if post is a custom post type and only during the first execution of the action quick_edit_custom_box
if ( $post->post_type != 'post' || did_action( 'quick_edit_custom_box' ) !== 1 ) return;

Initial URL


Initial Description
Adding custom fields to the quick edit panel in Wordpress is easy using built-in hooks. However, the hook to add fields seems to be called multiple times, adding duplicate fields to the quick edit panel. Adding this code to the top of the function being called by quick_edit_custom_box checks if the action has already been called and prevents it from being called again.

More info [here](http://wp.tutsplus.com/tutorials/extending-the-quick-edit-tool-for-taxonomy-terms/ "Extending the Quick Edit Tool for Taxonomy Terms | Wptuts+")

Initial Title
Fix duplicate fields with quick_edit_custom_box hook in Wordpress

Initial Tags
wordpress

Initial Language
PHP