Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .dev/tests/php/test-title-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ function test_hide_page_title_non_page() {
*/
function test_hide_page_title_callback() {

do_action( 'rest_api_init' );

$post_title_visible = $this->factory->post->create(
[
'post_title' => 'Show Post title',
Expand Down
28 changes: 18 additions & 10 deletions includes/title-meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,24 @@ function setup() {

add_filter( 'go_page_title_args', $n( 'hide_page_title' ) );

register_meta(
'post',
'hide_page_title',
array(
'sanitize_callback' => $n( 'hide_page_title_callback' ),
'type' => 'string',
'description' => __( 'Hide Page Title.', 'go' ),
'show_in_rest' => true,
'single' => true,
)
add_action(
'rest_api_init',
/**
* Register the meta field for the REST API.
*/
function() {
register_meta(
'post',
'hide_page_title',
array(
'sanitize_callback' => 'Go\Title_Meta\hide_page_title_callback',
'type' => 'string',
'description' => __( 'Hide Page Title.', 'go' ),
'show_in_rest' => true,
'single' => true,
)
);
}
);

}
Expand Down
Loading