[wp-trac] [WordPress Trac] #42785: Change default of `show_in_rest` in register_post_type and register_taxonomy
WordPress Trac
noreply at wordpress.org
Thu Jun 21 13:06:53 UTC 2018
#42785: Change default of `show_in_rest` in register_post_type and
register_taxonomy
-------------------------------------------------+-------------------------
Reporter: joehoyle | Owner: pento
Type: enhancement | Status: assigned
Priority: normal | Milestone: Future
| Release
Component: REST API | Version:
Severity: normal | Resolution:
Keywords: has-patch needs-unit-tests needs- | Focuses:
refresh |
-------------------------------------------------+-------------------------
Comment (by andizer):
I was looking at the latest diff file and I have one point of
consideration. I discovered the following being used twice, why not
wrapping this a function, make it reusable?
{{{#!php
<?php
$show_in_rest_default = false;
if ( ! empty( $args['public'] ) || ! empty( $args['publicly_queryable'] )
) {
$show_in_rest_default = true;
}
}}}
Another thing to consider is assigning the if-statement directly to the
variable:
{{{#!php
<?php
$show_in_rest_default = ( ! empty( $args['public'] ) || ! empty(
$args['publicly_queryable'] ) );
}}}
--
Ticket URL: <https://core.trac.wordpress.org/ticket/42785#comment:35>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list