WP nonce invalid

Have a quick script to search for untranslated pages, and then returning a translate link. (Polylang makes a new post for a translation, which is then linked to the original.)

All is working well, except the bloody nonce.
$url = admin_url(‘post-new.php?post_type=product&from_post=’ . $ID . ‘&new_lang=’ . $lang);

$nonce_url = wp_nonce_url($url);
Returns a beautifully formatted url, with an invalid nonce:

The link in the admin panel reads exactly the same, but with a working nonce:

I like to think Im alright with WP, but this is breaking my head.
Does anyone have any sort of idea why it is generating invalid links??

Read more here:: WP nonce invalid

Leave a Reply

Your email address will not be published. Required fields are marked *