Title: Shortcode problem
Last modified: August 19, 2016

---

# Shortcode problem

 *  Resolved [ed4becky](https://wordpress.org/support/users/ed4becky/)
 * (@ed4becky)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/shortcode-problem-2/)
 * I am having some trouble getting my shortcode to pass a parameter.
 * In my page I put:
 * [rootsPersona personId=’p111′ /]
 * My shortcode handler code is:
 *     ```
       function rootsPersonaHandler( $atts, $content = null ) {
       	$rootsPersonId = $atts["personId"];
       	$block = "rootsPersonaHandler: $rootsPersonId";
       	if(isset($rootsPersonId)) {
       	// this block never gets called
       	}
       	return $block;
       }
       ```
   
 * However, $rootsPersonId is always coming up as unset. “rootsPersonaHandler:” 
   is all that ever gets passed.
 * Can anyone else see the issue? I’m stuck.
 * Thanks
    Ed

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/shortcode-problem-2/#post-1348695)
 * Just a guess but don’t you need to do an add_shortcode somewhere?
 *     ```
       add_shortcode( 'rootsPersona', 'rootsPersonaHandler' );
       ```
   
 * Related:
    [Shortcode_API](http://codex.wordpress.org/Shortcode_API)
 *  Thread Starter [ed4becky](https://wordpress.org/support/users/ed4becky/)
 * (@ed4becky)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/shortcode-problem-2/#post-1348698)
 * Yes, I left all the admin/setup stuff out.
 * The handler is getting called, in that I see “rootsPersonaHandler:” in my output.**
   $rootsPersonId = $atts[“personId”]; ** just always comes up empty.
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/shortcode-problem-2/#post-1348705)
 * It the case thing. This works:
 *     ```
       function rootspersonahandler( $atts, $content = null ) {
       	$rootspersonid = $atts["personid"];
       	$block = "rootsPersonaHandler: $rootspersonid";
       	if(isset($rootspersonid)) {
       	// this block never gets called
       	}
       	return $block;
       }
       add_shortcode( 'rootspersona', 'rootspersonahandler' );
       ```
   
 *  Thread Starter [ed4becky](https://wordpress.org/support/users/ed4becky/)
 * (@ed4becky)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/shortcode-problem-2/#post-1348706)
 * DOH!
 * Yep, that was it. Thank you.
 *  [MichaelH](https://wordpress.org/support/users/michaelh/)
 * (@michaelh)
 * [16 years, 5 months ago](https://wordpress.org/support/topic/shortcode-problem-2/#post-1348707)
 * Actually just need to fix this:
 *     ```
       $rootsPersonId = $atts["personid"];
       ```
   

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Shortcode problem’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 5 replies
 * 2 participants
 * Last reply from: [MichaelH](https://wordpress.org/support/users/michaelh/)
 * Last activity: [16 years, 5 months ago](https://wordpress.org/support/topic/shortcode-problem-2/#post-1348707)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
