Last active
December 18, 2019 02:54
-
-
Save dnavarrojr/9282d795a258ff194d7938ae43dfac8c to your computer and use it in GitHub Desktop.
Attempt to add a CLASS to the BODY tag in WordPress, not working.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'body_class', function( $classes ) { | |
$restrict_page = ( get_field( 'msp_registration_required' ) ? true : false ); | |
error_log( "before count = " . count( $classes ) ); | |
if ( $restrict_page ) { | |
$classes[] = 'msp-restrict-page'; | |
} | |
error_log( "after count = " . count( $classes ) ); | |
return $classes; | |
} ); |
Count before 7
Count after 8
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Theme: BeaverBuilder Version: 1.7.4.1
WordPress: 5.3.1