Client Revenue$134,157,125
Service Disabled Veteran Owned Small Business.
Spear Brand Logo
Top web design and digital marketing in Las Vegas. Helping our clients grow with marketing-first web design and digital strategies that convert. 702 Pros Logo 2020
Service Disabled Veteran Owned Small Business.

How to remove broken and unused shortcodes

Updated April 12, 2022
~ minute read
How to remove broken and unused shortcodes

Content Key

Share this Post :
Get the most out of your marketing
Join over 100,000 of the most intelligent marketers in the galaxy, and receive marketing news and insights straight to your inbox.
Enter Email to Get Started:
(We will never share your information.)

How to remove broken and unused shortcodes

When using shortcodes on your WordPress website, you can find that it makes adding redundant code across your website a whole lot easier as well as makes any changes to the shortcode apply to all instances of that shortcode all across your website. However, you may find that once you stop using a short code, there will be remnants of its existence all across your website leaving broken shortcode text in its place.

To fix that, in this article I will offer you three solutions and show you how to remove broken and unused shortcodes.

Manually Remove Shortcodes

Method number one is the most obvious and tedious way to remove them, and that is going through the entire website and removing it from the places you placed the shortcode. This method is best used only when you have a couple of instances of the shortcode website all across your website.

But however, you will find that removing these when you have way more than 10 instances of these shortcodes, can be way too much to remove so there has to be a faster solution, and lucky for you there is.

Hide Shortcodes from Users

An easy way to remove these shortcodes is to hide them by using the following code and pasting it in your functions.php file. This piece of code replaces the shortcode with an empty value:

-Place the shortcode name in as the first argument

add_shortcode( ‘add_shortcode_name_here)’, ‘__return_false’ );
NOTE: Make sure this shortcode is inactive before applying it.

Hide Shortcodes from with Regex

You also have the ability to hide all unused/broken shortcodes all across your website using this piece of code that uses regex to hide unused shortcodes all across your website. However, there are limitations with this method as they will not remove all shortcodes.

Paste this code into you funtions.php file:


add_filter(‘the_content’, ‘mte_remove_unused_shortcode’);
function mte_remove_unused_shortcode($content)
{ $pattern = mte_get_unused_shortcode_regex();
$content = preg_replace_callback( ‘/’. $pattern .‘/s’, ‘strip_shortcode_tag’, $content );
return $content;
}
function mte_get_unused_shortcode_regex() {
global $shortcode_tags;
$tagnames = array_keys($shortcode_tags);
$tagregexp = join( ‘|’, array_map(‘preg_quote’, $tagnames) );
$regex = ‘\[(\[?)’;
$regex .= “(?!$tagregexp)”;
$regex .= ‘\b([^\]\/]*(?:\/(?!\])[^\]\/]*)*?)(?:(\/)\]|\](?:([^\[]*+(?:\[(?!\/\2\])[^\[]*+)*+)\[\/\2\])?)(\]?)’;
return $regex;
}

Use a Plugin to remove shortcodes

You can use the plugin called “Hide Unwanted Shortcodes” to remove them which has an easy-to-use interface to do that.

All you have to do is:

  1. Search “Hide Unwanted Shortcodes” Plugin install and active
  2. Go to tool > Hide Unwanted Shortcodes > Follow instructions listed on the page

 

Leave a Reply

Get a Free Digital Marketing Quote!
Want to talk now?
Give us a call at (702) 904-4262

Powered by OnSago

More Great Posts

The Best Venues for Team Building and Corporate Events in Houston

Team building activities help boost morale and foster better communication within a team. As the world transitions back to the old normal, there’s never been a better time to host a corporate event to strengthen your team and shape company goals for the year’s last quarter. If you’re planning to organize corporate events and team-building… Read More »

Read More »
Advertise with us
Join our advertising network to grow your business. Give us a call at (702) 904-4262
34.99 WordPress Updates | WordPress Support by 702 Pros
Sponsored
Best Top #1 How to remove broken and unused shortcodes Las Vegas, NV | How to remove broken and unused shortcodes Agency | Justin Young, US Air Force Veteran and CEO of 702 Pros
Justin Young Signature - 702 Pros

Justin YoungCEO of 702 Pros

I'm Justin Young
Air Force Veteran, Founder and CEO of 702 Pros.

I lead our team to grow our client’s businesses with smart and innovative web design and digital sales systems. I treat every business like it were my own, giving each the attention it deserves. In short, our experts will focus on delivering the best results producing the greatest ROI for your business.

Let’s talk about your business!

VOSB CVE AWARD

Our How to remove broken and unused shortcodes Agency will work hard to make sure your business succeeds online

Our How to remove broken and unused shortcodes experts are waiting to build your business credibility like never before. Let our Las Vegas NV team help grow your brand with digital marketing & WordPress management solutions, built around producing the highest return on your business investment.

2022Winner
Best Web Design Agency in Las Vegas, NV
2022Winner
Best Digital Marketing Agency in Las Vegas, NV
2022Winner
Best SEO Agency in Las Vegas, NV

Deals on Web Design Pricing in Las Vegas, NV

Hurry our web design deals in Las Vegas, NV will only last for a limited time only. Our team of Las Vegas, NV web designers have the experience and knowledge to get your business off to the best start possible or improve your business presence with SEO Las Vegas, NV, digital marketing Las Vegas, NV, web support and website hosting Las Vegas, NV

Grow with the Pros

Let us know about you to get started.

Want to talk now? Give us a call at (702) 904-4262

Powered by OnSago

Ready to speak with a marketing expert?

Call our team @
+1(702)904-4262

Our Pros have your back with award-winning design and marketing,Including proven systems focused on producing the best return on your investment.

702 Pros is veteran-led design by Justin Young—Air Force Veteran and Digital Marketing Las Vegas, NV Authority.

2022Winner
Best Web Design Agency in the United States
702 Pros Landscape Logo Vector - with url and grow with digital catchphrase
Google Partners
Meta Business Partners
Inc 5000
Kyla Sloan | Kyla Estes | Client Management | Reception | Sales
Advertising with Us
Kyla SloanAdvertising Specialist
Our team has the digital and traditional marketing skills to get you in front of customers looking for your product or service.
Want to talk now? Give us a call at (702) 904-4262

Powered by OnSago

Add Your Business To the 702 Pros' Directory
Please add some general information about your business.
A problem was detected in the following Form. Submitting it could result in errors. Please contact the site administrator.
Want to talk now? Give us a call at (702) 904-4262

Powered by OnSago

2022 Sale

Get 20% off!

All Web Design Packages
A problem was detected in the following Form. Submitting it could result in errors. Please contact the site administrator.
Days
Hours
Minutes
Seconds
Want to talk now? Give us a call at (702) 904-4262

Powered by OnSago