WordPress.org

Ready to get started?Download WordPress

Forums

Media Library Assistant
[resolved] Not seeing custom taxonomies (8 posts)

  1. jpsingleton
    Member
    Posted 11 months ago #

    Hey! Thanks for the plugin. I'm really enthused about being able to bulk tag my images. Prior to installing Media Library Assistant, I had already created a few custom taxonomies and enabled them on the attachment post type. However, I had to tag images one at a time, by opening up the image, selecting the tags and saving. Obviously time-consuming.

    At this point, I've installed Media Library Assistant (v1.30 on WP 3.5.1), but when I look at the settings page where it lists the available taxonomies, it doesn't include any of the custom taxonomies I've created. Is there anything in particular I need to do to make it recognize them?

    Thanks in advance.

    http://wordpress.org/extend/plugins/media-library-assistant/

  2. David Lingren
    Member
    Plugin Author

    Posted 11 months ago #

    Thanks for the encouragement and for this question.

    MLA should automatically recognize and offer all of the registered taxonomies on its Settings page. It works for custom taxonomies on my test system.

    I can think of a couple of things to look for. First, your taxonomy must have 'show_ui' => true when you call register_taxonomy(). Second, your user account must have permissions to access and edit the taxonomies. Third, if you are using the "Role Scoper" plugin, make sure it is not preventing access to your taxonomies.

    If none of that helps, can you give me more information about how you create the taxonomies? Perhaps they aren't registered when MLA is loaded and composing the Settings page. Do the taxonomies appear in the Edit Media screen? Any further details you can provide would help me replicate your issue. Thanks for you help!

  3. jpsingleton
    Member
    Posted 11 months ago #

    Show UI is set as true, I have full permissions, and I'm not using Role Scoper.

    I'm creating the taxonomies using Magic Fields 2... which may be the problem, though I'm not sure why that would be. The taxonomies do appear in the Edit Media screen (as they did before I installed MLA).

    Here is a screenshot of the settings page:
    http://i1314.photobucket.com/albums/t570/jparksingleton/MF2forMLA_zpsaebf65ce.png

    To test outside of MF2, I pasted this code (taken straight from the codex) directly into my functions.php:

    add_action( 'init', 'create_book_tax' );
    
    	function create_book_tax()
    	{
    	   register_taxonomy(
    	      'genre',
    	      'book',
    	      array(
    	         'label' => __( 'Genre' ),
    	         'rewrite' => array( 'slug' => 'genre' ),
    	         'hierarchical' => true
    	      )
    	   );
    	}

    And Genre appears in the taxonomy list in the MLA settings.

    Thanks for your help.

  4. David Lingren
    Member
    Plugin Author

    Posted 11 months ago #

    This is great - thorough and clear, thanks! Thanks, too, for taking the time to conduct the "outside of MF2" test.

    I suspect there's something about how or when MF2 registers its taxonomies that is preventing MLA from finding them. I will download and install MF2 and see if I can get to the bottom of the issue and fix it. I will post my progress or results here.

  5. David Lingren
    Member
    Plugin Author

    Posted 11 months ago #

    I have found a small defect in Media Library Assistant (MLA) that was exposed by the way Magic Fields 2 (MF2) registers its custom taxonomies. I will fix this in the next version, but if you are in a hurry there are two ways you can fix your MLA installation before that.

    First, you could use the Plugin Editor (Plugins/Edit Plugin) and fix your source code:

    1. Open the Admin Dashboard and navigate to Plugins/Editor.
    2. In the "Select plugin to edit:" dropdown list, pick Media Library Assistant and click "Select".
    3. Go down the list of Plugin Files and click on "media-library-assistant/includes/class-mla-options.php".
    4. Fix the bug (details below).
    5. Click "Update File" to save your work.
    6. Go to the Settings/Media Library Assistant screen and check the results.

    The fix (step 4) is simple once you find the right line of code. If you have some other editor that shows line numbers, it's on line 851 in the version 1.30 source. If you can't see line numbers, you'll have to scroll down until you find it. You are looking for this code:

    public static function mla_taxonomy_option_handler( $action, $key, $value, $args = null ) {
        switch ( $action ) {
            case 'render':
                $taxonomies = get_taxonomies( array ( 'show_ui' => 'true' ), 'objects' );
                $current_values = self::mla_get_option( $key );
                $tax_support = isset( $current_values['tax_support'] ) ? $current_values['tax_support'] : array();
                $tax_quick_edit = isset( $current_values['tax_quick_edit'] ) ? $current_values['tax_quick_edit'] : array();
                $tax_filter = isset( $current_values['tax_filter'] ) ? $current_values['tax_filter'] : '';

    You want to fix this line

    $taxonomies = get_taxonomies( array ( 'show_ui' => 'true' ), 'objects' );

    removing the quote marks around "true", i.e., from 'show_ui' => 'true' to 'show_ui' => true - simple!

    If you don't feel comfortable doing that, I can send you a new copy of the file with the fix applied to it. If that's better for you, send me your e-mail address; go to the "Contact Us" page at our web site:

    Fair Trade Judaica/Contact Us

    Let me know what you'd like to do. Thanks again for your interest and for bringing this issue to my attention.

  6. David Lingren
    Member
    Plugin Author

    Posted 11 months ago #

    Well, on further inspection of my plugin code I've found a few other places with a similar defect. Perhaps it's best if I send you the updates. If you want them, send me your e-mail address as described above. Sorry for the confusion.

  7. jpsingleton
    Member
    Posted 11 months ago #

    Fantastic. Thanks so much for your help! Emailing you now.

  8. David Lingren
    Member
    Plugin Author

    Posted 9 months ago #

    I have released version 1.40, which contains the fix for this bug. Thanks again for your help in finding the problem and testing the fix.

Reply

You must log in to post.

About this Plugin

About this Topic