- Shopping cart
- Checkout
- Order complete
/** * KAROHS | n8n to Yoast SEO * * Registers three Yoast fields for the native WordPress REST API. * * Applies to standard posts only. * Send values inside a JSON "meta" object. * Updates require permission to edit the target post. */ add_action('init', function () { $fields = [ '_yoast_wpseo_title' => 'Yoast SEO title', '_yoast_wpseo_metadesc' => 'Yoast meta description', '_yoast_wpseo_focuskw' => 'Yoast focus keyphrase', ]; foreach ($fields as $meta_key => $description) { register_post_meta('post', $meta_key, [ 'type' => 'string', 'single' => true, 'description' => $description, // Return these fields only in authenticated edit context. 'show_in_rest' => [ 'schema' => [ 'type' => 'string', 'context' => ['edit'], ], ], 'sanitize_callback' => 'sanitize_text_field', 'auth_callback' => function ( $allowed, $meta_key, $post_id, $user_id, $cap, $caps ) { return $post_id > 0 && user_can($user_id, 'edit_post', $post_id); }, ]); } }, 20);