DavidEBrumbaugh / cleanshortcodes

WordPress plugin to remove unregistered shortcodes from posts and pages
3 stars 0 forks source link

Identifying the shortcodes #1

Open dartiss opened 8 years ago

dartiss commented 8 years ago

Sorry not an issue but more of a question but wasn't sure of a better way to ask it 😄

How are you identifying which shortcodes are registered? From a quick glance at the code I believe you're checking them from admin. I, and I'm sure I'm not alone, don't always register my shortcodes in admin, for performance reasons and will only show as registered when on the front-end.

I hope this makes sense.

DavidEBrumbaugh commented 8 years ago

I borrowed the code directly from https://wordpress.org/plugins/remove-orphan-shortcodes/ I did dump a list of all the shortcodes that were registered on the tool page, so I could see what I was leaving in, and I could look for codes I knew were supposed to be there.

But it is true I'm using this on the back end, so if you avoid registering the shortcodes in the admin side, you'll get them removed.

This is definitely more of a meat-cleaver approach than a scalpel approach. Visual Composer had left a ton of ugly shortcodes all over the database, so I was more than willing to put back any short codes I may have accidentally missed. Turned out I didn't need to, but I was willing to.

dartiss commented 8 years ago

Hmm, that may be a problem then. My YouTube Embed plugin alerts the user if they're using Jetpack Shortcodes as that also registers the [youtube] shortcode - I had to put a check both in front and back end for that as, if I remember correctly, it doesn't pick it up otherwise. I wouldn't want to be the person scrubbing genuine Jetpack shortcodes from blogs ;)

Are you planning on adding this to the wp.org repository or are you keeping it on Github?

DavidEBrumbaugh commented 8 years ago

I was just going to leave it on github. It was a "quick and dirty" fix. I didn't even plan on posting it until I saw Pippin Williams blog post and realized how big of a problem VC was.

Before I would put it on the officlal repo I would add a pre-pass that saved all the registered plugins from the front end to an option and another prepass of what I planned to delete (and an option not to delete). That was overkill for what I needed it for. It's not complete enough to put on the .org repo.

dartiss commented 8 years ago

That sounds sensible - my plugin does much the same, sweeping both front and back end.