Last active
November 9, 2021 18:23
-
-
Save MjHead/43d1f8a09a88548dc813539b7f7a8619 to your computer and use it in GitHub Desktop.
Register meta field to show in Rest API
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'init', function() { | |
// replace your-post-type-slug and your-meta-field-name with your actual data | |
register_post_meta( 'your-post-type-slug', 'your-meta-field-name', array( | |
'single' => true, | |
'type' => 'string', | |
'default' => '', | |
'auth_callback' => '__return_true', | |
'show_in_rest' => true, | |
) ); | |
}, 99 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment