Using @One Trick Pony’s method, this should do what you want:
global $current_screen; // Makes the $current_screen object available
if ($current_screen && $current_screen->base == "edit") {
// Edit-page/post-only code here
}
If you want it on the add OR edit screens, then:
global $current_screen; // Makes the $current_screen object available
if ($current_screen && ($current_screen->base == "edit" || $current_screen->base == "post")) {
// Add-or-edit-page/post-only code
}
Related Posts:
- How to show my sidebar in specific page only?
- do_action in conditional
- is_front_page breaks with url parameters generated by a plugin
- Use modulo condition in ACF repeater Field
- Conditional Fields depending on checkboxes
- Conditional required fields for WordPress Contact Form 7
- Display WP Start bar on front page only
- functions.php conditional output for a single plugin
- Change page content based on dropdown selection
- Cannot install plugins even though www-data has write permissions
- Does wordpress have a post hit counter?
- How to call a plugin function from front end form
- How can I make content disappear when a user logs in?
- Adding New Role
- Get subcategories with JSON API plugin
- Custom url structure for custom template
- WooCommerce plugin appearance and look [closed]
- ID Conditional User Contact Methods Not Saving
- adding a text message beside the comment submit button
- New Plugin: Post update pushes a copy as a revision
- Plugin for gallery with thumbnails?
- Adding Plugin-specific Fields with wp_insert_post()?
- How to get the “stats” plugin that comes with a .wordpress.com blog?
- Hook into and send mail using WP Mail SMTP type plugin from HTML static front page?
- How to create ‘import dummy data’ option in custom wordpress plugin
- Missing Argument
- load_plugin_textdomain error
- Adding Shortcode to Text Widget
- W3 Total cache “empty all caches” and no stylesheets render [closed]
- Woocommerce pagination problem
- How to remove plug in styles for WPForms Lite [closed]
- Change upload folder for a CPT
- Plugin update failed – ‘Installation failed: 504 Gateway Time-out 504 Gateway Time-out nginx/1.15.8’ error message
- WP_Async_Task doesn’t appear to be running asynchronously
- Using plugin functions/methods within templates
- How to retain table data in wordpress phpunit tests
- Custom plugin appears outside of the sidebar container
- accessing parent variables in child construct without executing action in parent
- Ajax : Call undefined function plugin_function() … can’t call any plugin function
- How to over-ride a file in a plugin? [closed]
- Does having more than 30 Admin Ajax affects site performance (plugin)?
- execute function after one completed
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- How Can I Safely Remove WP-Super Cache without messing my site up? [closed]
- How to Resize the Custom Post Images?
- Display Plugin Panels Outside of Admin Areas
- Super slow plugin page (lots of error 500)
- Looking for Gallery Plugin [closed]
- Notice: Undefined index: mtral_field_subscriber
- Delete free version plugin will also delete premium plugin
- Hosting multiple sites
- How to delete a theme using AJAX
- Adding a responsive grid onto a page (without using a Bootstrap theme) [closed]
- Licensing a Plugin [closed]
- Add a function call after content automatically?
- Equivalent of admin.php for public pages
- Detect plugin/theme installation (via upload)
- Hook functions for Wp e-commerce? [closed]
- Engadget Like Featured Breaking Plugin
- sliding/fading header plugin or approach suggestion
- Google Analytics event tracking code being stripped out of links in Author box – WordPress site
- Elementor Sidebar not loading when PRO elements plugin is active
- how can we migrate wordpress 5.9 website from aws ec2 to new installed wp 5.9 oci compute
- Import Recent Posts Only and Ignore old ones if exist
- Security of a WordPress Plugin
- Editing a coupon generating plugin
- @wordpress/scripts advanced usage
- wp_post not working, keeps redirecting to posts page
- How to display ACF coustom field from category on author.php
- How to add Mobile field in Registration form using Theme my login Plugin
- What is the right way to populate a dropdown from MySql?
- prevent anonymous access to WordPress site (non-admin site)
- make p tag collapsed after 3 rows
- WPBakery Page Builder Shortcode Showing On Front Page For Post
- How to direct wordpress traffic to specific page
- Scroll to ID broken in main menu
- Comment restrictions Wodpress
- Set “Open in New tab” as default option
- Generate and send ICS file through WordPress
- Gutenberg editor in WordPress 5.0.3 /wp-json/wp/v2/pages/4713/autosaves?_locale=user 500 (Internal Server Error)
- Multi Language Code Snippet in WordPress
- WP Plugin permissions – create new files
- How to capture customer’s credit card details via PayPal on my checkout page?
- Add code to page template on page built with Visual Composer
- How to store multiple instances of the plugin’s options for various shortcodes
- .htaccess file doesn’t work, with hundred tries
- Installed plugins page do not show in wordpress dashboard
- plugin translation is not working
- A more elegant way to handle notices/warnings
- How can i see/log all requests coming from a registration form (not from the UI)?
- First argument is expected to be a valid callback for cp_admin_init and _canonical_charset
- how do you point ‘screen_function’ to a function in the same class? [closed]
- Get the url of attachments from the post?
- WordPress User Frontend Editing Custom Fields
- How can I modify the colors of my theme for a single section of my site? [closed]
- What are the downsides of using bootstrap in plugin development?
- Images get uploaded itself from the computer
- getPost() method and Pagination
- Oxygen plugin wordpress stuck in loading sequence forever when trying to edit a page [closed]
- plugin doesn’t retrieve data from database