Title: Shortcodes on pages
Last modified: August 20, 2016

---

# Shortcodes on pages

 *  [teeli](https://wordpress.org/support/users/teeli/)
 * (@teeli)
 * [14 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-on-pages/)
 * Hi,
 * I’m developing a plugin for wordpress and I’m trying to use shortcodes to add
   content to posts and pages. I added a shortcode handler for it like this:
 * function foobar_shortcode($attr) {
    ob_start(); include($pluginpath . ‘foobar.
   php’); $ret = ob_get_contents(); ob_end_clean(); return $ret; } add_action(‘foobar’,‘
   foobar_shortcode’);
 * Now [foobar] works on posts, but not on pages. So how can I get shortcodes to
   work also on pages?

The topic ‘Shortcodes on pages’ is closed to new replies.

## Tags

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

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 0 replies
 * 1 participant
 * Last reply from: [teeli](https://wordpress.org/support/users/teeli/)
 * Last activity: [14 years, 3 months ago](https://wordpress.org/support/topic/shortcodes-on-pages/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
