I know this is a vague question, please just spend time on it if you are in the mood, I don't need to be flamed for not being more precise.

I'm having a problem with a theme I'm developing, for some reason it breaks the export function of WordPress.

I'm not asking for anyone to solve my problems here, but after having spend some hours on it now, I'd like to ask, if anyone recognizes this problem, and would give me a hint as to in what direction to look for the problem.

Somehow I have a feeling it has to do with a nonce check failure, but not sure..

Anyway the problem is, that if i click the Export button in the page


then I get the WP Failure Notice Screen. The url I'm taking to is this:


and the page says:

Are you sure you want to do this? Please try again.

I think this must be coming from wp_explain_nonce() inside wp-includes/functions.php

If I switch to the twenty ten theme the problem is gone. Back to my theme, and it's there, so it must be the theme..

Any advice on where to look or how to approach catching the bug in my theme is welcome.

  • Could you please move your solution to the separate answer? It is more in line with site's mechanics.
    – Rarst
    Jul 7, 2011 at 20:34
  • @Rarst, I try that now, I moved it to your answer, must be peer reviewed. Jul 7, 2011 at 20:42
  • 1
    No, move your solution to a separate answer, don't edit someone else's answer.
    – EAMann
    Jul 7, 2011 at 20:47

2 Answers 2


The basic idea for debug here is that theme apparently influences something it totally should not. Either something is done in a wrong way or in a wrong place.

  1. Check that theme is not running any functionality directly in functions.php.

  2. Check that all of theme's functionality runs on appropriate hooks.

  3. For hooks that are used both on front-end and back-end conditionally exclude theme's functionality that is not supposed to work on back-end.

  • thank you, that was all I needed, and I found the problem. Jul 7, 2011 at 20:08
  • I was loading some admin related logic on the front end, where I did a check_admin_referer() if $_GET['download'] was defined. That was triggered by the export call, that also sets the same var. See my original question. Jul 7, 2011 at 20:10
  • ..no I'm babbling here, I wasn't loading on the front nd, it was also the back end it broke, but anyway, I was getting the nonce verification error because I intercepted the request while listening for the $_GET['download'] to be defined. I changed that into $_GET['mytheme_download'] and it was fine. Jul 7, 2011 at 20:33

The problem was that I had this code in one of my theme admin pages:

if (isset($_GET['download']))

which got triggered by the export request since that also sets $_GET['download'] var.

The solution I came up with was to make sure my check only ran when the relevant page was requested, and also I changed the variable to something unique:

if (isset($_GET['mytheme_download']))

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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