Created
November 19, 2015 12:59
-
-
Save mattradford/be7ac89aebfdcc01d51b to your computer and use it in GitHub Desktop.
Add REST visibility to CPT created with extended CPTS.
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
//http://wordpress.stackexchange.com/questions/201657/wp-rest-api-fetch-posts-from-post-type | |
add_action( 'init', 'add_adverts_to_json_api', 30 ); | |
function add_adverts_to_json_api(){ | |
global $wp_post_types; | |
$wp_post_types['advert']->show_in_rest = true; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment