How can I identify it as admin page or not?

I only want to display it on all pages without the admin pages. How can? How to detect is it admin page or not?

My custom plugin file: ~/wp-content/plugins/mycplugin/mycplugin.php

if ( not admin page ) { // ?

    if ( defined ( 'WP_AUTO_UPDATE_CORE' ) ) {

        print '<div style="background-color: black; bottom: 0; color: white; font-family: monospace; font-size: 10px; opacity: 0.5; padding: 0.5em; position: fixed; width: 100%;">' . WP_AUTO_UPDATE_CORE . '</div>';

    } else {}

} else {}

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

Use is_admin() function. It will return true if it’s wp-admin page and false on frontend.
more here https://developer.wordpress.org/reference/functions/is_admin/


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x