Title: Shortcode for Post Title in Content
Last modified: August 21, 2016

---

# Shortcode for Post Title in Content

 *  Resolved [wasanajones](https://wordpress.org/support/users/wasanajones/)
 * (@wasanajones)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/shortcode-for/)
 * I need to create a shortcode to return the post title in the body of the content.
 * with PHP enabled <?php the_title(); ?> returns what I want, but it gets stripped
   by WP and is a security risk to enable PHP.
 * 1) is there a Shortcode generator plugin for PHP functions?
 * 2) what would be the specific code for functions.php to make this work?
 * thanks

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

 *  [Borko](https://wordpress.org/support/users/media-x/)
 * (@media-x)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/shortcode-for/#post-4032320)
 * Check [Generate WP](http://generatewp.com/shortcodes/). There’s also the [Shortcodes Generator plugin](http://wordpress.org/plugins/shortcodes-generator/)
   but it’s compatible (tested) only up to WP 3.4.2
 *  Thread Starter [wasanajones](https://wordpress.org/support/users/wasanajones/)
 * (@wasanajones)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/shortcode-for/#post-4032333)
 * thanks for that lead — nice resource
 * it didn’t quite answer what I needed but it did prompt me to use better search
   terms for looking into this
 * stackoverflow had this snippet to add to functions.php which gave me just what
   I needed
 *     ```
       function myshortcode_title( ){
          return get_the_title();
       }
       add_shortcode( 'page_title', 'myshortcode_title' );
       ```
   

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

The topic ‘Shortcode for Post Title in Content’ is closed to new replies.

## Tags

 * [enable PHP](https://wordpress.org/support/topic-tag/enable-php/)
 * [post title](https://wordpress.org/support/topic-tag/post-title/)
 * [shortcode](https://wordpress.org/support/topic-tag/shortcode/)
 * [shortcode plugin](https://wordpress.org/support/topic-tag/shortcode-plugin/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [wasanajones](https://wordpress.org/support/users/wasanajones/)
 * Last activity: [12 years, 8 months ago](https://wordpress.org/support/topic/shortcode-for/#post-4032333)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
