Skip to content

Instantly share code, notes, and snippets.

@imath
Created September 13, 2019 04:21
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save imath/1727bcd2097e5640e129b7dd6a3a79f3 to your computer and use it in GitHub Desktop.
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/)
<?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