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/
Related Posts:
- WP 3.3 How to Add Menu Items to the Admin Bar?
- Unit tests – Dealing with dependencies
- Changing Plugin Load Order
- Should I create a theme or a plugin?
- How should you hook a session_start() when authoring a plugin?
- How to sync with plugins update after I have done manual optimizations?
- How to retrieve a value via get_option when the option_value is stored in a multi-dimensional array?
- How to change wordpress post title?
- Add Admin Menu Inside Construct or Init
- How to create a plugin that only operates on the home page?
- Adding callback function for wp_ajax_ has no effect
- How to properly modify get_userdata in plugin to get roles to update in database
- How to create thumbnail of different files?
- Admin-ajax.php appending a status code to ajax response
- Create a plugin to change the action to which a function is hooked
- comment_email hook doesn’t seem to work for comment editor field
- Why is the reset password key missing in the reset password email?
- Paging on a future post loop?
- How to pass custom options from widget form to widget update callback?
- How can I add a field to make link nofollow to the WordPress Link Inspector Window?
- Version upgrade: can my plugin filter the SQL statements issued during a database upgrade?
- WordPress admin deleted user details not removed in database. How to delete WordPress Users from Database
- How to show large image in checkout page using WP Ecommerce plugin [closed]
- Why do I need to check if wp_nonce_field() exists before using it
- settings_fields() doesn’t work for other roles except admin
- edit_{$taxonomy} | Hook
- Worpdress cannot create directory
- Subscribe to author?
- how to make custom bulk actions for a WP_List_Table (core class)
- Get name and email of current unregistered user, who has recently submitted name and email in comment form?
- How to associate an existing user to a site in a multisite setup programmatically
- Changing upload dir in a plugin regardless of post type
- Set page template programaticlly in plugin
- Auto save permalink setting page with the plugin activation
- creating custom function to log actions in plugin
- Alter post object before display
- How to use output buffering in WordPress hooked functions?
- Howto: Use Custom Post Types as Submenu Items in Admin
- Show custom data instead of 404
- How to localize admin.php only once
- What’s the right way to instantiate new blocks and/or the plugin itself in toto when using wppb architecture?
- How can I get a list of CPT inside a plugin file?
- Creating a custom Gutenberg block with columns
- Serve text/html from wp-json API via WPEngine, headers not being set properly
- wp_schedule_event seems to be being added twice
- Add a new confirmation page before saving
- What happens when two or more plugins use the same hook?
- Plugin is not generating title tags on any pages or posts
- Plugin Development/ Stop CSS clashes.
- Setting up Version Control for WordPress plugin development
- Ajax submit result opens in admin-ajax.php
- WordPress debug messages not displaying
- Show message from backend
- Cannot change caption for a plugin
- Error passing post_content to function
- PHP File_exist() not working – Checking if File Exist in WordPress Theme Directory
- Woocommerce inventory [closed]
- Add a check box in Menu Settings
- how to load the comment template from a plugin
- Is there any way to fire heartbeat API from for website visitors?
- Look for a file in a theme before loading from plugin
- Include HTML (Bootstrap Modal Box) with a plugin into my header
- when i activate my plugin i want to auto create pages with shortcodes
- Using init hook for register_taxonomy is causing invalid_taxonomy in wp_insert_term()
- Cannot stop wpautop from messing up my plug-in output
- How can I prevent ‘500 internal server error’ because of a long install process?
- Update product prices from remote file
- Displaying custom content from a plugin within the active theme
- Downloading File via headers doesnt work
- product-attribute-slug-is-too-long-28-characters-max
- Custom plugin & calling REST api of wordpress instance the plugins is running on
- Add variables from rewrite rules to query var
- Show list of categories that has posts with different taxonomies
- “add to cart” links css class “ajax_add_to_cart” doesn’t show in woocommerce in widget sidebar
- How do I specify where to save the debug.log?
- What is the source of the $post_id in a hook argument?
- WordPress Fatal error: Uncaught Error: Call to undefined function dbDelta()
- WordPress custom url without using any of the custom tags given
- How to call a plugin function from a page
- Code for cron to delete posts that contain specific expression (e.g. “unable to fetch” every 30 minutes
- If user is logged-in display/hide widgets ( siteorigine) [closed]
- Use content filter on the post that is password-protected
- foreach argument to get specific file types getting too many returns
- How to fetch the post content from the wordpress editor before it can be saved(published)?
- pull data from wordpress database
- How does one set cookies in WordPress without getting the ‘headers not sent’ error? within WP
- Object Oriented plugin, add action and variables
- Filter the_content() to add custom figure tags
- Glyphicons Dont Show in WordPress Plugin Only
- Change the search results header from plugin
- Installing plugins on installation/activation
- Tracing dashboard publish settings from input form in WordPress
- Post data in wp-admin to external database
- Add query string variables to all hyperlinks URL matching a specified domain
- Virtual Page with Registration form
- Is there such a thing as a WordPress console?
- Images not displaying on live server
- redirect word-press page with page values
- Loading jQuery library from WordPress admin
- Forcing the Uninstall Hook to fail