Skip to content

Conversation

code-flow
Copy link
Contributor

WordPress 4.6.0 respectively 4.4.0 has new filters hooks that can be used instead of accessing global variables. I also updated the old code examples to match the "books/genre" example.

WordPress 4.6.0 respectively 4.4.0 has new filters hooks that can be used instead of accessing global variables. I also updated the old code examples to match the "books/genre" example from above.
Copy link
Member

@rmccue rmccue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks good, but I'd drop the legacy stuff for <4.6.0, as the API was merged in 4.7, so we only care about that anyway.

Copy link
Member

@rmccue rmccue left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two more tiny issues, sorry for not noticing first time around

if ( 'book' === $post_type ) {
$args['show_in_rest'] = true;

// Optionally customize the rest_base or rest_controller_class
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your indentation is off here, and the line above has extra whitespace. We should be using tabs throughout :)

if ( 'genre' === $taxonomy_name ) {
$args['show_in_rest'] = true;

// Optionally customize the rest_base or rest_controller_class
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@code-flow
Copy link
Contributor Author

No worries. Didn't recognize it in the first place. I've fixed it and hopefully you can pass it through now ;)

Copy link
Contributor

@kadamwhite kadamwhite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thanks for cleaning that up!

@kadamwhite kadamwhite merged commit c7c9384 into WP-API:master Sep 16, 2018
@code-flow code-flow deleted the patch-2 branch October 3, 2018 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

3 participants