The MU forums have moved to WordPress.org

How to detect which admin page the user is on? (6 posts)

  1. skcsknathan001
    Member
    Posted 15 years ago #

    How to detect which admin page the user is on? I would like to print out some JavaScript based on the page user is on. So is there a page with details of these? How to see the user is on the Write Post or Write Page or Add Link or Add Category or well... basically each page. Is there any little tricks that I could use in PHP to print out JavaScript based on the page user is on?

    Thanks for your time

  2. corourke
    Member
    Posted 15 years ago #

    I'd suggest taking a look at the pages themselves since the page is already marked by the system (view the dashboard with css styles turned off and you'll see that it is showing that info already. Editing the source files themselves will allow you to add the code you want.

  3. lunabyte
    Member
    Posted 15 years ago #

    Checking the server var for request_uri is an option.

    You could plug into the admin footer function and make it work without hacks.

  4. skcsknathan001
    Member
    Posted 15 years ago #

    Yes, lunabyte that's what I wanted to do. I'm going to plug into admin_footer but I want to know what page the user is.

  5. lunabyte
    Member
    Posted 15 years ago #

    Checking the server var for request_uri is an option.
    Checking the server var for request_uri is an option.
    Checking the server var for request_uri is an option.
    Checking the server var for request_uri is an option.

  6. skcsknathan001
    Member
    Posted 15 years ago #

    Thanks all

    I found this

    if ('link-add.php' == basename($_SERVER['SCRIPT_FILENAME']))

    could do this for any pages in WordPress

About this Topic

  • Started 15 years ago by skcsknathan001
  • Latest reply from skcsknathan001