I use register_taxonomy_for_object_type( 'category', 'page' ); to add a taxonomy to the Page, but the url doesn't show the page's category slug.

So is there any way to display the slug of the current category of the Page like:


  • How is your URL currently structured? Have you taken a look at the "Permalinks" page in Settings?
    – YourManDan
    Mar 15 at 18:22
  • @YourManDan My current permalink setting: /%category%/%postname%/ , seem like category's slug not working on Page post type
    – pdutie94
    Mar 16 at 2:19
  • There's not enough information here to work with yet, please revise your answer with your full relevant code for your register_taxonomy_for_object_type() function and the location you put the code in. Ensure you're using the proper add_action call as outlined here.
    – YourManDan
    Mar 16 at 14:21


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.