I'm working with the MegaMenu here echo wp_nonce_url() is showing an error All output should run through an escaping function according to wpcs. I gave echo esc_url( wp_nonce_url()) Is it correct? Point me where am I going wrong.

enter image description here

  • esc_url() is correct. Did it not work? – Jacob Peattie May 17 '18 at 9:19
  • @Jacob Peattie yeah it is working fine. thanks, I just want to know it is correct or not according to the WordPress standards. – Mehraj Khan May 17 '18 at 9:26

Yes it is correct. Escaping should be done based on context, and since wp_nonce_url() is used in an hrefas proper url, you should use esc_url.

| 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.