How to add Page support to the Series Plugin?

4 Replies ·

  1. Justin,

    I’m trying to do something as simple as add support for ‘page’ to your series plugin.

    I know that it works by simply going into functions-taxonomies.php file and adding ‘page’ to the array. Please see the following.

    // Register the taxonomies.
    array( 'post', 'page' ),
    apply_filters( 'series/series_taxonomy_args', $series_args )

    This works, however I also know it is not the correct way.

    I’m also tracking that I can use register_taxonomy_for_object_type as referenced in the following codex article.


    But, I’m just not connecting the dots. Can you provide some guidance?

    What is the best way to approach this?

    Any help would be greatly appreciated!


  2. Mac



    I figured it out.

    Here’s what I came up with:

    function add_taxonomies_to_pages() {
    register_taxonomy_for_object_type( 'series', 'page' );
    add_action( 'init', 'add_taxonomies_to_pages' );

    Thanks for the almost immediate follow-on!


  3. Justin Tadlock

    Well, you got it. The big thing I’d recommending doing different is prefixing your function name so that it doesn’t conflict with anything in the future and cause an error.

    add_action( 'init', 'mac_add_series_to_page' );
    function mac_add_series_to_page() {
        register_taxonomy_for_object_type( 'series', 'page' );

    Or, if you’re on PHP 5.3+, you can use an anonymous function like so:

    add_action( 'init', function() {
        register_taxonomy_for_object_type( 'series', 'page' );
    } );
  4. Mac

    Thank you for the follow on and advice.

    Also, it’s been a pleasure revisiting this plugin.

    Very clean!