• This is a tough one and a little unusual:

    I wrote a plugin that is dependent on knowing if the site visiter is viewing a page or post and the specific ID of that page or post as well as the category ID if any.

    When an admin is editing or adding a new post or page, I have added a meta box that displays certain plugin settings and the ability to turn one of the plugin settings on or off.

    I use a single function each time the meta data needs to be displayed in one of the admin panels ( edit or add new post or page.)

    Within my function I use get_post_type($post) and $post->ID to display something like this in the meta box if post “Post ID = 15” else “Page ID = 15”

    This all works fine…but!

    My function also shows up when you create a new category or edit an existing category but I am having problems getting the my function to work on edit-tag.php.

    Problem:
    I need to add a third case to my function that checks if is category and get category ID from the edit-tag.php page.

    My function():
    case 1 : if is post echo ‘Post ID = x’

    case 2 : if is page echo ‘Page ID = x’

    Case 3 : if is category echo ‘Category ID = x’

    I have tried all kinds of WP taxonomy, tag and category functions but I cannot get them to work in the edit-tag.php page.

    Solution:
    I need to add case 3 into my function so that I can echo out the something like this:

    case 3 :
    if ( is category ) {
    get category ID;
    echo ‘Category ID =’ . $cat_ID;
    }

    …but case 3 needs to work under edit-tag.php

  • The topic ‘Displaying category taxonomy and category ID on edit-tag.php’ is closed to new replies.