Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Don't let kses strip out ids from section tags
<?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