Filter texts without wordpress formatting

0

How can I filter only the text, ie what is outside of the tags, the ones in the html tags I want it to remain, I just do not want the ones that are in these tag types [/ et_pb_text] or the stylization I do not want , how to filter only the text? Note: I'm doing in php, example:

[/et_pb_text][et_pb_code admin_label=""Code"" disabled=""off""][ess_grid alias="Homepage"][/et_pb_code][/et_pb_column][et_pb_column type=""1_4""][et_pb_text admin_label=""performers-title"" background_layout=""light"" text_orientation=""left"" use_border_color=""off"" border_style=""solid"" custom_margin=""||5px|"" disabled=""off""]

<h2>Based in London and working on events both across the UK and internationally</h2>
Contraband International is a high-end artist, event and entertainment agency. We supply the very best entertainers and performers for all types of <strong>corporate entertainment</strong> events and parties, private celebrations, PR campaigns, marketing stunts and international events. It’s our expertise, creativity and friendly approach which makes us the most sought-after talent and entertainment agency in the UK.
<h4>Performers</h4>

[/et_pb_text][et_pb_code admin_label=""Code"" disabled=""off""][ess_grid alias=&quot;Performers&quot;][/et_pb_code][/et_pb_column][et_pb_column type=""1_4""][et_pb_text admin_label=""Reality TV-title"" background_layout=""light"" text_orientation=""left"" use_border_color=""off"" border_style=""solid"" custom_margin=""||5px|"" disabled=""off"" border_color=""#ffffff""]

I want to filter only what is readable as the contents of h2, h4, and plain text

    
asked by anonymous 21.07.2017 / 18:11

1 answer

1

Use wp_kses to filter your content with only allowed tags :

// remove todas as tags exceto as h2
echo wp_kses( $post->post_content, array( 'h2' => array() );

The link has the correct array format of the second parameter, which indicates the allowed tags and attributes.

    
22.07.2017 / 05:52