I am using this syntax to remove excerpts on Custom Taxonomy archive listings and it works great:
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
return $length;
}
However, I also have two other Custom Taxomoies....
Is this correct to add the other two like this?
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
elseif ( is_tax('us_state') ) {
return 0;
}
elseif ( is_tax('cities') ) {
return 0;
}
return $length;
}
I want the same result for all three...
Just want to make sure I am doing it correctly.
Thanks
I am using this syntax to remove excerpts on Custom Taxonomy archive listings and it works great:
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
return $length;
}
However, I also have two other Custom Taxomoies....
Is this correct to add the other two like this?
add_filter( 'excerpt_length','remove_excerpt', 1000 );
function remove_excerpt( $length )
{
if ( is_tax('country') ) {
return 0;
}
elseif ( is_tax('us_state') ) {
return 0;
}
elseif ( is_tax('cities') ) {
return 0;
}
return $length;
}
I want the same result for all three...
Just want to make sure I am doing it correctly.
Thanks
Share Improve this question edited May 11, 2019 at 0:02 fuxia♦ 107k39 gold badges255 silver badges459 bronze badges asked May 10, 2019 at 23:53 HenryHenry 9831 gold badge8 silver badges31 bronze badges 1- * I tested it and it works fine. I just want to be sure and learn. Thanks – Henry Commented May 10, 2019 at 23:58
1 Answer
Reset to default 1I believe you can also pass an array to is_tax
:
if(is_tax(array('country', 'us_state', 'cities')) {
return 0;
}
Give that a try, but otherwise what you have is fine.