I have written a security function.I want to call this function in all pages which are created by wordpress back end only (Does not want want to called by all php files).Is there any hook available?.Please Help

  • Is this a front end function Commented Aug 12, 2014 at 11:47
  • Yes ,this is a front end function written in functions.php
    – Rex Rex
    Commented Aug 12, 2014 at 11:48
  • I'm not sure what you mean, you want something that runs when a user views a post of type page on the frontend? Your question suggests you misunderstand how templates work ( it hints you think the template determines the query, not the other way around ). Can you give an example of a post of type page that wasn't created by the WordPress back end and how it it different?
    – Tom J Nowell
    Commented Aug 12, 2014 at 11:57
  • Also what does your function do? I know you said security but that could mean anything
    – Tom J Nowell
    Commented Aug 12, 2014 at 11:57
  • Wait, what are you trying to do with this function? Just for context.
    – Tomás Cot
    Commented Aug 12, 2014 at 13:46

2 Answers 2


What about admin_init ?

Description is:

admin_init is triggered before any other hook when a user accesses the admin area. This hook doesn't provide any parameters, so it can only be used to callback a specified function.


You can tie it to the 'wp_head' hook.


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.