WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Suppose I have content like

Here is some content in xxx 

Here is content outside xxx ...

Can I somehow just get

  1. content inside [xxx] ONLY
  2. content outside [xxx] ONLY
share|improve this question
up vote 3 down vote accepted

Depends on the shortcode. If you have access to the shortcode's handler function, that function's second argument is the content inside the shortcode:

function wpse20136_shortcode( $atts, $content ){
  // $content has the content inside xxx

register_shortcode( 'xxx', 'wpse20136_shortcode' );

For getting all content not in shortcodes, that's easy. strip_shortcodes() does that:

strip_shortcodes( get_the_content() );

for example, will give you the content of the current post with only the content not inside shortcodes.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.