Created
September 13, 2019 04:21
-
-
Save imath/1727bcd2097e5640e129b7dd6a3a79f3 to your computer and use it in GitHub Desktop.
Activate "Activités de publication" for all new page items by default. (Requires https://github.com/imath/activites-de-publication/)
This file contains 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
<?php | |
/** | |
* For more information about how to use the bp-custom.php file | |
* @see https://codex.buddypress.org/themes/bp-custom-php/ | |
*/ | |
// Exit if accessed directly | |
defined( 'ABSPATH' ) || exit; | |
/** | |
* Activate "Activités de publication" for all new page items by default. | |
* | |
* @param boolean $show_in_rest True by default. | |
* @param string $post_type The post type name. | |
* @return boolean|array Unchanged argument or an array containing | |
* the metadata schema default value. | |
*/ | |
function imath_register_meta_rest_attributes( $show_in_rest = true, $post_type = '' ) { | |
if ( 'page' === $post_type ) { | |
$show_in_rest = array( | |
'schema' => array( | |
'default' => true, | |
), | |
); | |
} | |
return $show_in_rest; | |
} | |
add_filter( 'post_activities_register_meta_rest_attributes', 'imath_register_meta_rest_attributes', 10, 2 ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment