Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cater for new labels in CPT registration #21

Closed
2 tasks done
bobbingwide opened this issue Oct 8, 2021 · 1 comment
Closed
2 tasks done

Cater for new labels in CPT registration #21

bobbingwide opened this issue Oct 8, 2021 · 1 comment
Assignees

Comments

@bobbingwide
Copy link
Owner

bobbingwide commented Oct 8, 2021

Since WordPress 5.8, a variation of the core/navigation-link block is registered in the server for each Custom Post Type and Taxonomy where the show_in_nav_menus attribute is true.

For CPTs registered using bw_register_post_type(), many of these variations were indistiguishable in the block editor. In blocks.wp-a2z.org I had 16 variations of "Post Link".

For more information, and a screenshot, see bobbingwide/oik-blocks#49

This is because the strings being used to generate the variation name and description were not defined in the post type's / taxonomy's labels array.

bobbingwide/oik#183 addresses the problem for post types registered using bw_register_post_type(), but doesn't cater for CPTs and taxonomies that have been created / updated using oik-types.

Requirement

  • Ensure core/navigation-link variations for CPTs and taxonomies are identifiable.
  • Support oik-types definitions created prior to WordPress 5.8

Solution

  • For CPTs which are modified by oik-types merge the labels produced by bw_register_post_type() with those that have been saved in the bw_types option.
  • For CPTs created by oik-types unset the saved $args['labels'] and use the values produced by bw_register_post_type().

At this point in time it doesn't seem necessary to remove the old labels from the bw_types option.

@bobbingwide
Copy link
Owner Author

Delivered in v2.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant