Support » Plugin: Media Category Library » Add Media Category via PHP CODE

  • Resolved XPOL555


    Hi all,
    This plugin is really grates and helped me a lot!
    I’ve done a custom function to list the medias category depending of the current logged user:

    <?php function comm_list_usr(){
        $current_user = wp_get_current_user();
    	echo '[mediacat cats='.$current_user->user_login.' orderby="date" order="DESC"]';
    	} ?>

    This function is executed in a single specific page.
    Now i’ve to do that when one new user is registered it creates the category with same name of the user…

    The question is:
    Is there a function to create a new media category via PHP?


Viewing 1 replies (of 1 total)
  • Plugin Author timmcdaniels



    Using the default media category taxonomy, you could do something like this:

    wp_insert_term( ‘New Category Here’, ‘media-category’ );



Viewing 1 replies (of 1 total)
  • The topic ‘Add Media Category via PHP CODE’ is closed to new replies.