Question

My website is displaying, if print_r, two different ID for the same post. If i ask:

<?php echo $post->ID;?>

in the single.php it gives me a number. If i do the same thing in the sidebar it gives me a completely different one.

This is what I get with the print_r on the single.php

stdClass Object ( [ID] => 59 [post_author] => 1 [post_date] => 2012-01-01 20:29:18 
[post_date_gmt] => 2012-01-01 20:29:18 [post_content] => È universalmente
riconosciuto (...) [post_title] => fdsfdsfs [show_in_menu] => 1 [link_link] => 1
[no_follow_link] => 0 [alt_link_text] => [custom_link_class] => [redirect_url] =>
[target_blank] => 0 [alt_title_attribute] => [post_excerpt] => [post_status] => publish
[comment_status] => closed [ping_status] => closed [post_password] =>
[post_name] => fdsfdsfs [to_ping] => [pinged] => [post_modified] => 2012-01-07 19:53:44
[post_modified_gmt] => 2012-01-07 19:53:44 [post_content_filtered] =>
[post_parent] => 0 [guid] => http://www.museidibra.it/prova/?p=59 [menu_order] => 0
[post_type] => post [post_mime_type] => [comment_count] => 0
[ancestors] => Array ( ) [filter] => raw )

While this is what I get from the sidebar:

stdClass Object ( [ID] => 93 [post_author] => 1 [post_date] => 2012-01-02 08:39:29
[post_date_gmt] => 2012-01-02 08:39:29 [post_content] => prova 3 (...)
[post_title] => prova 3 [show_in_menu] => 1 [link_link] => 1 [no_follow_link] => 0
[alt_link_text] => [custom_link_class] => [redirect_url] => [target_blank] => 0
[alt_title_attribute] => [post_excerpt] => [post_status] => publish
[comment_status] => closed [ping_status] => closed [post_password] =>
[post_name] => prova-3 [to_ping] => [pinged] => [post_modified] => 2012-01-07 13:06:15
[post_modified_gmt] => 2012-01-07 13:06:15 [post_content_filtered] =>
[post_parent] => 0 [guid] => http://www.museidibra.it/prova/?p=93 [menu_order] => 0
[post_type] => post [post_mime_type] => [comment_count] => 0 [filter] => raw )

It is basically 2 different posts.

NOTE: this thing happens only in post that i tagged. I f i don't tag the post, the resulting IDs will be the same.

Here, you can find an example of this from my website, where print_r shows 2 different IDs for the same post.

Help please, this thing is freaking me out.

Thanks

No correct solution

Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top