I'm hooking to sanitize_title. How can i check if post being edited is page? I mean the type.

  • That function is a generic function used in many places, not just for post titles. What do you need to filter it for? There might be a better option, depending on the context. – Jacob Peattie Jun 23 '19 at 3:16
  • i've got this function hooked to sanitize_title. It removes words from titles when a post i saved. But i don't want it to affect pages. Since this is backend i don't think is_page() is set yet. – Michael Rogers Jun 23 '19 at 8:57
  • Also get_current_screen() is NULL for me at this point. – Michael Rogers Jun 23 '19 at 9:36

Your Answer

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

Browse other questions tagged or ask your own question.