This seems like simple thing but I need way to determine whether the current screen is for Add New or Edit ( a sort of wordpress admin conditional tag). Is there a built in function for this already, or … any idea how to accomplish?
Leave a Reply
You must be logged in to post a comment.
here is a function that i have:
Usage
the usage is simple just like any other conditional tag , few examples:
check for new or edit page:
check for new post page:
check for edit post page:
combine this with a
$typenow
global to check for a specific post type edit page:I prefer
get_current_screen()
, as it is much simpler:(Codex)
I wanted to
enqueue script
andstyles
only on specificnew/edit
post type screens. Created a function to check if i am onedit/new-post
screen of the givenCPT
.to use the function, pass the post type name.
i have this function
which returns true in the edit page and false on the other pages…