Support » Plugin: Media Library Categories » Advice in the FAQ generates an error

  • Resolved FR_lucien



    this FAQ advice “How to use separate categories for the WordPress Media Library (and don’t use the same categories as in posts & pages)?” generates a lot of error lines into the error-log file.

    PHP Warning: Use of undefined constant ‘wpmediacategory_taxonomy’ – assumed ‘‘wpmediacategory_taxonomy’’ (this will throw an Error in a future version of PHP) in /home/myhome/public_html/blog/wp-content/themes/myttheme/functions.php on line 43

    How can I modify the code, knowing that I’m a complete beginner in PHP coding?
    Thank you.

    Notice: sorry, I’m not English speaker.

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


    Hi, Maybe you copied the quotes the wrong way? See this problem with smart quotes.

    * 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
    • This reply was modified 2 years, 7 months ago by jeffrey-wp.
    Plugin Author jeffrey-wp


    I have also updated the faq to better display the code blocks

    Thread Starter FR_lucien



    I made the modification again via the php code pasted in Atom and now it’s right.

    Thanks a lot 😉

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Advice in the FAQ generates an error’ is closed to new replies.