• Resolved keytastic

    (@keytastic)


    I’m trying to make it so that authors can tag their media and search for media using those tags. Currently I am running into two problems with my code:

    1. The Media Tags page doesn’t show up in the Dashboard for anyone but the administrator
    2. Tagged pictures don’t show up in search!

    Here is my code:

    <?php
    
    /**
    // register new taxonomy which applies to attachments
    function wptp_add_media_tag_taxonomy() {
        $labels = array(
            'name'              => 'Media Tags',
            'singular_name'     => 'Media Tag',
            'search_items'      => 'Search Media Tags',
            'all_items'         => 'All Media Tags',
            'parent_item'       => 'Parent Media Tag',
            'parent_item_colon' => 'Parent Media Tag:',
            'edit_item'         => 'Edit Media Tag',
            'update_item'       => 'Update Media Tag',
            'add_new_item'      => 'Add New Media Tag',
            'new_item_name'     => 'New Media Tag Name',
            'menu_name'         => 'Media Tag',
        );
    
        $args = array(
            'labels' => $labels,
            'hierarchical' => true,
            'query_var' => 'true',
            'rewrite' => 'true',
            'show_admin_column' => 'true',
        );
    
        register_taxonomy( 'media_tag', 'attachment', $args );
    }
    add_action( 'init', 'wptp_add_media_tag_taxonomy' );

    Is there a better way to do this? It seems odd to me that there isn’t a good way to tag and search photos.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘searchable media tags’ is closed to new replies.