Last active
January 21, 2022 02:27
-
-
Save mjangda/3578355 to your computer and use it in GitHub Desktop.
Don't let kses strip out ids from section tags
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 | |
function x_allow_ids_on_tags() { | |
global $allowedposttags; | |
$tags = array( 'section', 'article' ); | |
$new_attributes = array( 'id' => array() ); | |
foreach ( $tags as $tag ) { | |
if ( isset( $allowedposttags[ $tag ] ) && is_array( $allowedposttags[ $tag ] ) ) | |
$allowedposttags[ $tag ] = array_merge( $allowedposttags[ $tag ], $new_attributes ); | |
} | |
} | |
// Do it, to it! | |
add_action( 'init', 'x_allow_ids_on_tags' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment