Title: Get Post ID
Last modified: August 31, 2016

---

# Get Post ID

 *  Resolved [luckybutt](https://wordpress.org/support/users/luckybutt/)
 * (@luckybutt)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/get-post-id-4/)
 * A very basic thing is missing in this good plugin.
    I cannot find any way by 
   default to get post ID to wrap my div with post ID. I just edited plugin file
   and added simple code below to get post ID. same like other codes {img} {url}
   etc… But It would be nice if you put it in plugin code , I cannot update plugin
   because of custom editing. And i think it is very basic thing to be added. because
   wrapping a post in a div with postID is very common thing in wordpress. Below
   are new lines
 * add After line 1868
 *     ```
       $postidd = $p->id;
       ```
   
 * add After line 1896
 *     ```
       'postidd' => $postidd,
       ```
   
 * Edit line to add postidd in list
 *     ```
       $pattern = '/\{(excerpt|summary|stats|postidd|title|image|thumb|thumb_img|rating|score|url|text_title|author|category|views|comments|date)\}/i';
       ```
   
 * finally add code after
    array_map(‘strtolower’, $matches[0]);
 *     ```
       if ( in_array("{postidd}", $matches[0]) ) {
       $string = str_replace( "{postidd}", $data['postidd'], $string );
       }
       ```
   
 * and then use {postidd} in post_html option of plugin.
 * Maybe it helps someone also Please put it in you next release. Thank you
 * [https://wordpress.org/plugins/wordpress-popular-posts/](https://wordpress.org/plugins/wordpress-popular-posts/)

Viewing 1 replies (of 1 total)

 *  Plugin Author [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * (@hcabrera)
 * [10 years, 2 months ago](https://wordpress.org/support/topic/get-post-id-4/#post-7138425)
 * Hi there!
 * [It’s been done already](https://github.com/cabrerahector/wordpress-popular-posts/commit/644962173afab0822f1cad20ed3544d51bf479ad),
   but thanks for the suggestion anyways. This change (and a few others) will be
   available once the next version of WPP is out 🙂

Viewing 1 replies (of 1 total)

The topic ‘Get Post ID’ is closed to new replies.

 * ![](https://ps.w.org/wordpress-popular-posts/assets/icon-256x256.png?rev=1232659)
 * [WP Popular Posts](https://wordpress.org/plugins/wordpress-popular-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordpress-popular-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordpress-popular-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordpress-popular-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordpress-popular-posts/reviews/)

## Tags

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

 * 1 reply
 * 2 participants
 * Last reply from: [Hector Cabrera](https://wordpress.org/support/users/hcabrera/)
 * Last activity: [10 years, 2 months ago](https://wordpress.org/support/topic/get-post-id-4/#post-7138425)
 * Status: resolved