hlashbrooke / WordPress-Plugin-Template

A robust code template for creating a standards-compliant WordPress plugin.
https://hughlashbrooke.com/
GNU General Public License v2.0
1.03k stars 329 forks source link

Quick edit clearing the meta data of registered metaboxes #103

Open rafasashi opened 1 year ago

rafasashi commented 1 year ago

Since "Quick Edit" triggers the save_post hook the following function might end up clearing the meta data of registered metaboxes that are not included in the Quick Edit form:

https://github.com/hlashbrooke/WordPress-Plugin-Template/blob/27d728611ae47828dcf7fa46e0502bb9a94f6ce4/includes/lib/class-wordpress-plugin-template-admin-api.php#L341

This issue is referenced here:

https://wordpress.stackexchange.com/questions/4931/quick-edit-update-clears-out-my-custom-meta-values

I suggest replacing

if( !$post_id )

by

if( !$post_id || isset($_POST['_inline_edit']) )