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 {}
有帮助吗?

解决方案

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/

许可以下: CC-BY-SA归因
scroll top