Skip to content

Enable tags for galleries

WordPress allows for posts to have categories and tags by default. Sunshine Photo Cart creates a Custom Post Type “sunshine-gallery” for all it’s galleries. Using the code below, you can enable the default tagging functionality for your galleries:

add_filter( 'sunshine_gallery_post_type_args', 'add_tags_to_sunshine_gallery' );
function add_tags_to_sunshine_gallery( $args ) {
	$args['taxonomies'] = isset( $args['taxonomies'] ) ? array_merge( $args['taxonomies'], array( 'post_tag' ) ) : array( 'post_tag' );
	return $args;
}

Learn how to add this custom code to your WordPress website

Screenshot showing where tags are available in the WordPress admin when adding/editing a gallery
Tags are now available in the right sidebar when adding/editing a gallery

Still need help?

If you have not yet found your answer in the documentation articles, please contact support