Skip to content

Instantly share code, notes, and snippets.

@msaari
Created March 9, 2017 12:15
Show Gist options
  • Save msaari/8545d3c5928b9b914e0f367a37e3b938 to your computer and use it in GitHub Desktop.
Save msaari/8545d3c5928b9b914e0f367a37e3b938 to your computer and use it in GitHub Desktop.
Media taxonomy that Relevanssi can index
<?php
// Add this code to theme functions.php
add_action( 'init', 'create_media_tax' );
function create_media_tax() {
register_taxonomy(
'media_tag',
'attachment',
array(
'label' => __( 'Media tag' ),
'rewrite' => array( 'slug' => 'media_tag' ),
'hierarchical' => true,
)
);
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment