I'm using {status}_{post_type}
hook and need to grab a custom meta from the post:
add_action( 'pending_book', function( $post_id, $post ) {
$foo = get_post_meta($post_id, 'book_author', true);
var_dump($foo);
}, 99, 2 );
But it return string(0) ""
The post was generated in frontend, using GravityForms.
What can I do?
Here is the solution: GravityForm hook
add_action( 'gform_after_submission_13', function( $entry, $form ) {
$foo = get_post_meta($entry['post_id'], 'book_author', true);
var_dump($foo);
}, 10, 2 );
Where 13 is the ID of form.
More info here: https://www.gravityhelp.com/documentation/article/gform_after_submission/