Skip to content

Commit

Permalink
Add another hook to catch late-registered CPTs
Browse files Browse the repository at this point in the history
  • Loading branch information
codebykat committed Apr 15, 2019
1 parent 12e8ed7 commit 441df54
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modules/likes.php
Original file line number Diff line number Diff line change
Expand Up @@ -632,6 +632,10 @@ function jetpack_post_likes_register_rest_field() {
// Add Likes post_meta to the REST API Post response.
add_action( 'rest_api_init', 'jetpack_post_likes_register_rest_field' );

// Some CPTs (e.g. Jetpack portfolios and testimonials) get registered with
// restapi_theme_init because they depend on theme support, so let's also hook to that
add_action( 'restapi_theme_init', 'jetpack_post_likes_register_rest_field', 20 );

/**
* Set the Likes and Sharing Gutenberg extension availability
*/
Expand Down
4 changes: 4 additions & 0 deletions modules/sharedaddy/sharing.php
Original file line number Diff line number Diff line change
Expand Up @@ -610,6 +610,10 @@ function jetpack_post_sharing_register_rest_field() {
// Add Sharing post_meta to the REST API Post response.
add_action( 'rest_api_init', 'jetpack_post_sharing_register_rest_field' );

// Some CPTs (e.g. Jetpack portfolios and testimonials) get registered with
// restapi_theme_init because they depend on theme support, so let's also hook to that
add_action( 'restapi_theme_init', 'jetpack_post_likes_register_rest_field', 20 );

function sharing_admin_init() {
global $sharing_admin;

Expand Down

0 comments on commit 441df54

Please sign in to comment.