Im trying to save some meta values when I save a "product" post type. However my save_post action does not seem to be firing. Am I calling it wrong? The code within the class below shows the meta boxes in the admin fine but its just not calling the save.

 * Called from main plugin file
function knp_load_first() {

    new KnpvAdminProductMeta();

add_action('plugins_loaded', 'knp_load_first');

 * Output meta boxes and save meta values
class KnpvAdminProductMeta {

    function __construct(){

        //Save the meta values
        add_meta_box('knpv_submission_fields', 'Editable Submission Fields', array($this, 'knpv_submission_fields'), 'product', 'normal', 'default');
        add_action( 'save_post', [$this, 'knpv_save_meta_fields'], 10, 3 );


    public function knpv_save_meta_fields(){

        //For tesitng
        //This should kill the script and output the posted values
        //It doesnt!

        //Update the post meta
        update_post_meta($post_id, 'submissiondata', $_POST['submissiondata']);
        update_post_meta($post_id, 'included-with', $_POST['included-with'] );


  • 1
    are you using the block editor or the classic editor? save_post fires for all post types you might want to check for the post type or use the save_post_product hook
    – Tom J Nowell
    Feb 2, 2022 at 15:04

1 Answer 1



add_action('plugins_loaded', 'knp_load_first');


add_action('init', 'knp_load_first');

All good!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.