Just wrap it all in an ! is_admin()
check:
add_filter( 'wp_setup_nav_menu_item','decorate_mobile_menu' );
function decorate_mobile_menu($item) {
if ( ! is_admin() ) {
if ( strpos($item->title, 'SHIPPING') !== false) {
$split = explode(" IN ", $item->title);
$item->title="<span class="shipping-menu-item">" . $split[0] . ' IN </span>';
$item->title .= '<br/>';
$item->title .= '<span class="shipping-menu-item">' . $split[1] . '</span>';
}
}
return $item;
}
is_admin()
returns false
if you’re viewing the front-end and true
if you’re viewing the admin area.
Related Posts:
- Fatal error: Call to undefined function mysql_connect()
- Allow Editors to edit pending posts but not draft ones
- Pass a PHP variable to another file
- How Attackers write script into my php files?
- Fatal error: Call to undefined function plugin_dir_path()
- Switching wp_get_sites to get_sites
- How to get author ID when an author page is being viewed?
- Modify image while uploading
- Using Global Variables Expensive for PHP
- One button to change all settings in theme customizer?
- How to remove html comment from source?
- Need help on WordPress and php
- Looking to exclude blog posts from category Previous/Next buttons
- How php content after the first and second paragraph
- Automatic Excerpt Not Working
- Best way to create a user programatically
- How to resolve error “Cookies are blocked due to unexpected output.”?
- Can’t use get_results() in ajax query
- Is $hook a global variable in WordPress
- Notice: wpdb::prepare was called incorrectly. The query argument of wpdb::prepare() must have a placeholder
- WordPress Ajax Data problem
- Remove all nav menu classes ( but keep useful ones… )
- Hiding a php element from mobile browsers
- How do I turn a shortcode into PHP code?
- WordPress get pagination on wpdb get_results
- Can I change the contents of a description meta tag generated by Yoast?
- How to filter/hook-into retrieve_password() to filter $_POST[‘user_login’]?
- Sorting Posts | Alphabetical Order
- How to return a foreach inside a shortcode
- Shortcode content output but not in correct place
- Handling Body class based on Template
- Storing Array from returned database query and using the array in a new query
- Mass update excerpt
- PHP variable = get_the_post_thumbnail_url outputting without slashes
- Automatically adding new post categories to menu
- Show prices with tax in Woocommerce Mini Cart [closed]
- WordPress ajax doesn’t display object method on jQuery .change() function
- Get post id in a function when edit/add a post
- WordPress every page is 404 not found including admin resources
- get author_name from queried post
- get_template_part based upon post’s category
- Query if audio attachment AND/OR custom field
- post thumbnail, conditions, else wont work
- Using and saving custom dropdown boxes on user profiles
- How set a custom URL for a new theme file in WP?
- Add class to website based on post taxonomy
- Need php code’s output to display underneath a Divi Module
- Extending WP_Customize_Media_Control to return filename
- WP_Query | IF within $args array | Help me only add specific arguments if the argument is not blank
- what is the method to echo class attribute inside the i tag? [closed]
- PHP Warning: include(): Unable to allocate memory for pool
- javascript variable to wordpress php variable
- Do I need to edit my theme in order to change the title of my blog page?
- trouble with parse error [closed]
- Why does my settings form redirect to the homepage?
- Passing an array into WP_Query as a variable
- Can’t change website Title on wordpress
- Shortcodes showing in excerpt despite using strip_shortcodes
- How do I access post_meta key with php?
- Set cookie for visitor
- Remove Post if Advanced Custom Field is checked to fix paging
- Using php inside javascript [closed]
- Simple seo-friendly custom $_GET url rewrite with htaccess
- Is there a way to create a “copy post” link?
- How to separate product payment and shipping payment in WooCommerce checkout? [closed]
- add role on WordPress in PHP on a second database
- WordPress single.php get_header not working
- Load more posts using AJAX based on posts inside WP_Query
- Undefined array key 0 wp-includes/capabilities.php on line 76
- Store GA Client ID in User DB
- Hide author from search results meta, still display date and categories
- Why does a header location on admin_head remove the query var I’m setting in the location?
- A WordPress Page to display custom database query results
- Get all woocommerce product names with price and show using core php
- Is there a way to search for a missing endif?
- Site doesnt work once PHP changed to 7.1
- Changing WordPress author name in database
- How to detect and make links nofollow in author description
- admin uploads pre_get_posts not working as expected
- can’t delete a row from post_meta table
- Run PHP Results inside WP Shortcode
- Not able to get the exact URL of the file on server located in active wordpress theme
- Change taxonomy for categories
- Accessing Variables Used In a Plugin Using PHPStorm + XDebug
- Insert wordpress tags below posts via functions.php
- Show Nav Link To Users Signed In
- WordPress $GLOBALS and PHP $GLOBALS
- How to echo a different field if another field is empty?
- Remove the_content From Loop
- Display Sale Price Before Regular Price (WooCommerce)
- Load a Header in wordpress
- Trouble figuring out how to get my button to submit comment
- Using is home to get content [closed]
- Hide category by tag
- understanding wp_next_scheduled
- WordPress 6.1.1 UTF8 Slug Limit Increase
- How to add SKU and remove product title from WooCommerce url?
- php 8 compability admin interface
- How can I make below code to show grouping by country ranks in same div, example if in second loop rank 2nd must be show in same 2nd class div
- add_rewrite_rule image from /images/site2/favicon.ico to /favico.ico