php – Prevent WP from escaping html on edit posts screen

Question

In /wp-admin/includes/class-wp-posts-list-table there’s a snippet of code that strips html from excerpts on the edit posts screen:

echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>';> } else { esc_html( get_the_excerpt();}

I have found that I can get the html to show by editing the core file to this:

echo '<span class="protected-post-excerpt">' . esc_html( get_the_excerpt() ) . '</span>';> } else { get_the_excerpt();}

However, I know that editing core files is verboten, so I tried adapting this solution by adding this to functions.php:

remove_filter('get_the_excerpt', 'esc_html');

but it didn’t work.

Since I want to allow all tags, it doesn’t seem necessary to add wpse_allowedtags() as explained in the same post.

What am I missing?

0
lkl 2 weeks 2023-05-19T10:01:25-05:00 0 Answers 0 views 0

Leave an answer

Browse
Browse