Print_r visualizzando due diversi post-> ID se inseriti nella barra laterale o singolo.php

wordpress.stackexchange https://wordpress.stackexchange.com/questions/38287

  •  01-11-2019
  •  | 
  •  

Domanda

Il mio sito Web sta visualizzando, se print_r, due ID diverso per lo stesso post. Se chiedo:

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

Nel singolo.php mi dà un numero. Se faccio la stessa cosa nella barra laterale, me ne dà una completamente diversa.

Questo è quello che ottengo con print_r su 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 )

Mentre questo è quello che ottengo dalla barra laterale:

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 )

Sono fondamentalmente 2 post diversi.

Nota: questa cosa accade solo nel post che ho taggato. Non taggerò il post, gli ID risultanti saranno gli stessi.

Qui, puoi trovare un esempio di questo dal mio sito Web, in cui Print_r mostra 2 ID diversi per lo stesso post.

Aiuto per favore, questa cosa mi fa impazzire.

Grazie

Nessuna soluzione corretta

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a wordpress.stackexchange
scroll top