admin管理员组

文章数量:1418021

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

so i got this code

add_filter( 'abcdefg/json_ld', function( $data, $jsonld ) {
    if ( is_single() ) {
        $data['richSnippet']['articleBody'] = $jsonld->post->post_content;
    }
    return $data;   
}, 11, 2);

I'm simply trying to take the post_content and basically deliver only the text, currently its adding WPbakery tags (E.G [vc_row],[vc_column_txt] and so on, and also the usual h1/2/3 and so on)

i can somewhat read PHP code, but no where near the level of writing code. i was trying to take the $data after the return and "proccess" it through wp_strip_tags and then i figured i should probably run $data before it returns.. that didnt work.

so here i am.. any tips? thank you!

also just to make sure, it is running on functions.php.

Closed. This question is off-topic. It is not currently accepting answers.

Your question should be specific to WordPress. Generic PHP/JS/SQL/HTML/CSS questions might be better asked at Stack Overflow or another appropriate Stack Exchange network site. Third-party plugins and themes are off-topic for this site; they are better asked about at their developers' support routes.

Closed 5 years ago.

Improve this question

so i got this code

add_filter( 'abcdefg/json_ld', function( $data, $jsonld ) {
    if ( is_single() ) {
        $data['richSnippet']['articleBody'] = $jsonld->post->post_content;
    }
    return $data;   
}, 11, 2);

I'm simply trying to take the post_content and basically deliver only the text, currently its adding WPbakery tags (E.G [vc_row],[vc_column_txt] and so on, and also the usual h1/2/3 and so on)

i can somewhat read PHP code, but no where near the level of writing code. i was trying to take the $data after the return and "proccess" it through wp_strip_tags and then i figured i should probably run $data before it returns.. that didnt work.

so here i am.. any tips? thank you!

also just to make sure, it is running on functions.php.

Share Improve this question edited Jul 30, 2019 at 23:21 Tom J Nowell 61.2k7 gold badges79 silver badges150 bronze badges asked Jul 30, 2019 at 23:02 Shay OhayonShay Ohayon 111 bronze badge 2
  • What is the jsonld and where does this filter come from? Your code example doesn't include any tag stripping functions so it's not clear how you're trying to use the function – Tom J Nowell Commented Jul 31, 2019 at 20:58
  • It seems this is actual a RankMath SEO plugin question, you should contact RankMath SEO plugin support – Tom J Nowell Commented Aug 1, 2019 at 3:09
Add a comment  | 

1 Answer 1

Reset to default 1

Those aren't HTML tags, those are shortcodes. wp_strip_all_tags will strip out HTML tags such as <p> or <i>. For shortcodes you should strip out the shortcodes

I did a quick google which turned up strip_shortcodes on the official dev docs:

https://developer.wordpress/reference/functions/strip_shortcodes/

本文标签: seowpstripalltags