Title: Undefined variable: pid
Last modified: July 3, 2017

---

# Undefined variable: pid

 *  Resolved [mrprainx](https://wordpress.org/support/users/mrprainx/)
 * (@mrprainx)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-pid/)
 * Hello everyone.
 * In the last few days I’m getting an error on my posts where the star ratings 
   are:
 * `"Notice: Undefined variable: pid"`
 * I’ve put the code manually in the single.php file. The code I used is the one
   indicated in the plugin settings:
 * `<?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid); endif;?
   >`
 * What happened?

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

 *  Plugin Contributor [Kamal Khan](https://wordpress.org/support/users/bhittani/)
 * (@bhittani)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-pid/#post-9285646)
 * You haven’t define the variable $pid.
 * Either set it manually to a post id e.g. `$pid = 47;`
 * Or use `$pid = get_the_ID();` if inside the wordpress post loop.
 *  Thread Starter [mrprainx](https://wordpress.org/support/users/mrprainx/)
 * (@mrprainx)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-pid/#post-9286382)
 * Thank you Kamal.
 * Now it’s working properly.
 * I’ve edited the line as follow:
 * `<?php if(function_exists("kk_star_ratings")) : echo kk_star_ratings($pid = get_the_ID());
   endif; ?>`
 * Thank you again for your precious assistance.
 * Have a nice day.
 *  Thread Starter [mrprainx](https://wordpress.org/support/users/mrprainx/)
 * (@mrprainx)
 * [8 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-pid/#post-9286647)
 * Resolved

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

The topic ‘Undefined variable: pid’ is closed to new replies.

 * ![](https://ps.w.org/kk-star-ratings/assets/icon-256x256.jpg?rev=2140680)
 * [kk Star Ratings - Rate Post & Collect User Feedbacks](https://wordpress.org/plugins/kk-star-ratings/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/kk-star-ratings/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/kk-star-ratings/)
 * [Active Topics](https://wordpress.org/support/plugin/kk-star-ratings/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/kk-star-ratings/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/kk-star-ratings/reviews/)

## Tags

 * [pid](https://wordpress.org/support/topic-tag/pid/)
 * [undefined variable](https://wordpress.org/support/topic-tag/undefined-variable/)

 * 3 replies
 * 2 participants
 * Last reply from: [mrprainx](https://wordpress.org/support/users/mrprainx/)
 * Last activity: [8 years, 11 months ago](https://wordpress.org/support/topic/undefined-variable-pid/#post-9286647)
 * Status: resolved