Title: shortcode not working
Last modified: August 20, 2016

---

# shortcode not working

 *  [Upstreet Media](https://wordpress.org/support/users/phxvyper/)
 * (@phxvyper)
 * [15 years ago](https://wordpress.org/support/topic/shortcode-not-working-1/)
 * I have a plugin I’ve created and am using a shortcode. for some reason, I cannot
   get the shortcode to work.
 *     ```
       if(!class_exists('FE_SuperFiction'))
       {
       	class FE_SuperFiction {
       		function __construct() {
       			/** bunch of other code here **/
       			add_shortcode('fanficme_fanfiction', array(&$this, 'FeFiction_Site_Display'));		}
       			/** bunch of other code here **/
       		}
       		function FeFiction_Site_Display() {
       			/** bunch of code here **/
       			echo __LINE__.' - test ';
       			/** bunch of code here **/
       		}
       	}
       }
       ```
   
 * I then add a page with the content being: [fanficme_fanfiction]
 * I then visit that page and it still shows [fanficme_fanfiction] instead of the
   output I expect (in the above case, the line number and the text ” – test”.
 * I even went into wp-includes/shortcodes.php and confirmed that my shortcode is
   included.
 * **From the output of printing $output contained in do_shortcode:**
 *     ```
       (.?)\[(embed)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)
       (.?)\[(wp_caption|caption|gallery|embed|fanficme_fanfiction|ratings)\b(.*?)(?:(\/))?\](?:(.+?)\[\/\2\])?(.?)
       ```
   

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

 *  Thread Starter [Upstreet Media](https://wordpress.org/support/users/phxvyper/)
 * (@phxvyper)
 * [15 years ago](https://wordpress.org/support/topic/shortcode-not-working-1/#post-2124431)
 * I’ve been digging around more and I’m still at a loss as to why the shortcode
   is not working :/
 *  Thread Starter [Upstreet Media](https://wordpress.org/support/users/phxvyper/)
 * (@phxvyper)
 * [15 years ago](https://wordpress.org/support/topic/shortcode-not-working-1/#post-2124501)
 * When WP is executing the do_shortcode, for some reason $content is empty, which
   explains why it isn’t executing my function.
 * BUT, if $content is empty, how is it that when the page loads, my shortcode is
   displaying????
 * Something isn’t right here.
 *     ```
       function do_shortcode($content) {
       	global $shortcode_tags;
   
       	if (empty($shortcode_tags) || !is_array($shortcode_tags))
       		return $content;
   
       	$pattern = get_shortcode_regex();
       	return preg_replace_callback('/'.$pattern.'/s', 'do_shortcode_tag', $content);
       }
       ```
   

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

The topic ‘shortcode not working’ is closed to new replies.

## Tags

 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 1 participant
 * Last reply from: [Upstreet Media](https://wordpress.org/support/users/phxvyper/)
 * Last activity: [15 years ago](https://wordpress.org/support/topic/shortcode-not-working-1/#post-2124501)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
