• Resolved anonymized-14293447

    (@anonymized-14293447)


    Strange behaviour: if I open the media categories and click on the count number, I get a list of them. But if I open the posts’ categories I can see the ones that are actually media categories, and clicking on the count number I get a list of the posts. It looks like media categories have taken over the posts’.
    Any idea?

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author jeffrey-wp

    (@jeffrey-wp)

    Hi as described in the faq

    By default the WordPress Media Library uses the same categories as WordPress does (such as in posts & pages). If you want to use separate categories for the WordPress Media Library add this code to the file functions.php located in your theme or child-theme:

    /**
    * separate media categories from post categories
    * use a custom category called 'category_media' for the categories in the media library
    */
    add_filter( 'wpmediacategory_taxonomy', function(){ return 'category_media'; } ); //requires PHP 5.3 or newer

    Or if you have an older PHP version:
    add_filter( 'wpmediacategory_taxonomy', create_function( '' 'return "category_media";' ) ); //requires PHP 4.0.1 or newer

    • This reply was modified 6 years, 9 months ago by jeffrey-wp.
    Thread Starter anonymized-14293447

    (@anonymized-14293447)

    I don’t think this solution actually works. The media categories are still listed in the posts’ categories screen.

    Thread Starter anonymized-14293447

    (@anonymized-14293447)

    …it just creates conflict with categories/tags/archive pages.

    Plugin Author jeffrey-wp

    (@jeffrey-wp)

    You first have to remove the assigned categories to the media items before you activate the filter. Otherwise the categories remain assigned (but just not visible).
    You can temporary remove the filter, then with bulk actions remove all asigned categories. And after that add the filter.

    Still not working as separate for me. I deactivated the snippet (for PHP v 7.2) and selected all the items in the media library and bulk removed all categories. Then I ran garbage collection and WP database optimize.

    Both Media and Post Category pages continued to show the same items, which were all originally post categories. I deleted one of them in the Media Category screen to see if it was a separate duplicate, but it was also deleted from the Post list. Added it back in the Post list, and it is there in the Media list again.

    I also tried deactivating and uninstalling the Media Library Categories plug-in, and putting it back, and toggling the snippet activation.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘media categories mix with posts’ categories’ is closed to new replies.