Title: get primary title using shortcode
Last modified: February 19, 2021

---

# get primary title using shortcode

 *  Resolved [ramanandmehta](https://wordpress.org/support/users/ramanandmehta/)
 * (@ramanandmehta)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-primary-title-using-shorcode/)
 * Hi first of all thanks for this amazing plugin, I can’t explain how much this
   is helpful plugin for me.
    we can get the current post secondary title using 
   this shortcode- [secondary_title] but what if we want to get the primary title?
   which shortcode we can use? please help. —————————————————— function post_title_shortcode(){
   return get_the_title(); } add_shortcode(‘post_title’,’post_title_shortcode’);————————————————————–
   I added this code in my theme’s function.php and then using shorcode [post_title]
   but this is adding full title (primary + Secondary). I want to add only primary
   title using shortcode. Thanks.
    -  This topic was modified 5 years, 3 months ago by [ramanandmehta](https://wordpress.org/support/users/ramanandmehta/).

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

 *  [HindiCube](https://wordpress.org/support/users/hindicube/)
 * (@hindicube)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-primary-title-using-shorcode/#post-14093698)
 * thanks for this amazing seo plugin. it helped me a lot
    here are my some articles
   ypou can read : [flirt meaning ](https://hindicube.blogspot.com/2021/01/flirt-meaning-in-hindi.html)
 *  Plugin Author [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * (@thaikolja)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-primary-title-using-shorcode/#post-14096553)
 * Hi,
 * Sorry for the late reply.
 * Instead of `return get_the_title();`, try using:
 *     ```
       global $post;
   
       return $post->post_title;
       ```
   
 * I didn’t test it, but it should work. If not, I have another idea.
 *  Thread Starter [ramanandmehta](https://wordpress.org/support/users/ramanandmehta/)
 * (@ramanandmehta)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-primary-title-using-shorcode/#post-14096736)
 * Wow,.This is working sir, thank you very much. You are not just a WordPress developer,
   You are amazing by the mind and by the heart.
 *  Plugin Author [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * (@thaikolja)
 * [5 years, 3 months ago](https://wordpress.org/support/topic/get-primary-title-using-shorcode/#post-14096812)
 * Glad it worked out!

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

The topic ‘get primary title using shortcode’ is closed to new replies.

 * ![](https://ps.w.org/secondary-title/assets/icon.svg?rev=2520363)
 * [Secondary Title](https://wordpress.org/plugins/secondary-title/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/secondary-title/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/secondary-title/)
 * [Active Topics](https://wordpress.org/support/plugin/secondary-title/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/secondary-title/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/secondary-title/reviews/)

## Tags

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

 * 4 replies
 * 3 participants
 * Last reply from: [thaikolja](https://wordpress.org/support/users/thaikolja/)
 * Last activity: [5 years, 3 months ago](https://wordpress.org/support/topic/get-primary-title-using-shorcode/#post-14096812)
 * Status: resolved