I have a strange problem in my wordpress website.

My configuration:

  • WordPress 3.7.1
  • Custom template
  • 3 Custom post types

The problem (front-end)

  • all the page are the same (a cpt post)
  • all navigation menus are disappeared

The problem (back-end)

It is very strange but all the post lists under the custom post type sections shows me the page list. Moreover, the statistics above the table are properly referred to the custom post types. Some pictures can explain this better:

The only right table:

Informazioni - The only right!!!

The other wrong ones:




When the problem occurred?

I was doing some correction regarding a pagination of one of my cpt. here is what I did:

  • I've changed the number of default posts on the back-end
  • I've opened some files from my template doing nothing (just to check some parameters)

I have the feeling that I've inadvertently removed something (a row of code, a file) but I really need help to troubleshoot this problem...my site is broken for almost two hours now and I'm losing my mind!


Problem solved.

Here is what I did:

  1. I Thought: the only custom post type that is showed correctly on back-end is the cpt "Informazione". So maybe the problem is here
  2. I've disabled this custom post type and effectively everything come back to work as aspected
  3. Searching on the web I found that other users had the same problem. They solved adding a wp_reset_query() somewhere in their code. Me also I've tryed this solution before posting here, but without success. The difference was that now I knew that some query around the "Informazione" cpt was causing the problem
  4. I've disabled some block of codes until I've found the problem:


add_filter( 'pre_get_posts', 'my_get_posts' );
function my_get_posts( $query ) 
    if($query->get("page_id") == get_option("page_on_front")) 
        $query->set("post_type", "informazione");
        $query->set("posts_per_page", -1);
        return $query;

I was using this code in order to see in home page an "Informazione" post. I removed it and everything worked again.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.