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

I'm sure I'm missing something simple, as I rarely use shortcodes, but I can't seem to get the following shortcode to work.

I want it to be an "enclosing" short tag vs. a "self-closing", but its being treated as the latter.

[bio_image name="my name" title="my title"]
//image media in post content

with this functions.php code:

function bio_image_func( $atts, $content = null) {
    extract( shortcode_atts( array(
        'name' => 'employee',
        'title' => 'mastermind',
    ), $atts ) );
    return '<div class="team_photo"><p class="team_title"><span class="name">' . $name . '</span> <span class="title">' . $title . '</span></p>' . $content . '</div>';

add_shortcode( 'bio_image ', 'bio_image_func' );   


<div class="team_photo">
  <p class="team_title">
    <span class="name">my name</span> 
    <span class="title">my title</span>

<img src="my_img_src" ... />


As you can see, the closing tag is just being printed out. Any suggestions?

for reference: the shortcode codex page

share|improve this question
up vote 2 down vote accepted

Remove the space after the shortcode name.

add_shortcode( 'bio_image ', 'bio_image_func' );


add_shortcode( 'bio_image', 'bio_image_func' );

I think WordPress is looking for a closing tag for bio_image[space], which doesn't exist.

share|improve this answer
haha omg... it figures. Thank You. – Zach Lysobey Jun 21 '12 at 23:01
lol sorry! You were right when you said "I'm sure I'm missing something simple" ;) – getWeberForStackExchange Jun 21 '12 at 23:08

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.