Skip to content

Instantly share code, notes, and snippets.

@carlosonweb
Last active October 24, 2020 07:38
Show Gist options
  • Save carlosonweb/e2e3b9268fcea6effcd1ff082bcd35c1 to your computer and use it in GitHub Desktop.
Save carlosonweb/e2e3b9268fcea6effcd1ff082bcd35c1 to your computer and use it in GitHub Desktop.
Issue: Beaver Builder Posts Module's Taxonomy filters ( Content > Filter) don't work on SportsPress CPTs and taxonomies.
<?php
/**
*
* This happens only for non-logged in users or logged in users who don't have a SportsPress User Role.
* There are several custom taxonomies used by SportsPress, but the code below should fix it for the Leagues (sp_league) taxonomy.
*
* Use the following filter hooks to the other SportsPress taxonomies.
* -- 'sportspress_register_taxonomy_season' for Season (sp_season).
* -- 'sportspress_register_taxonomy_venue' for Venues (sp_venue)
* -- 'sportspress_register_taxonomy_position' for Positions (sp_position)
* -- 'sportspress_register_taxonomy_role' for Jobs (sp_role)
*
*/
add_filter( 'sportspress_register_taxonomy_league', function( $tax_league ) {
if ( ! is_user_logged_in() ) {
$tax_league[ 'show_ui' ] = true;
}
return $tax_league;
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment