WordPress.org

Make WordPress Core

Opened 4 years ago

Last modified 5 months ago

#36775 new defect (bug)

Shortcode stripping on frontend

Reported by: pixel8383 Owned by:
Milestone: Priority: normal
Severity: normal Version: 4.5.1
Component: Formatting Keywords:
Focuses: Cc:
PR Number:

Description

WordPress, since 3.6, introduced the audio tag. It should be used like it:

[audio src="file.mp3"]

My old & wrong code used into my blog was formatted like the following.

[audio:file.mp3]

This was generating an issue on Jetpack (which I consider solved now).
Analyizing the issue we discovered that Wordpress is stripping out from front end this bad formatted shortcode.

I then tried to use this non-existent shortcode:

[unuseful:file.mp3]

And the existent video one (badly implemented):

[video:file.mp3]

Both are rendered as plain text on the front end. So, only the bad formatted audio tag is being stripped.

The funny thing is that I can't actually type sentences like [audio is very loud] because are being stripped off.

I am not sure which one should be the default Wordpress behavior. For sure it's strange that's acting differently on audio/video or non-existing shortcodes.

Change History (6)

#1 @lukecavanagh
3 years ago

Could you not do a find and replace to update the shortcode to the correct version?

#2 @lukecavanagh
3 years ago

<audio class="wp-audio-shortcode" id="audio-11-2" preload="none" style="width: 100%; visibility: hidden;" controls="controls"><source type="audio/mpeg" src="http://file.mp3?_=2" /><a href="http://file.mp3">http://file.mp3</a></audio>
	</div><!-- .entry-content -->

This is how the correct shortcode renders when you view the source.

#3 @pixel8383
3 years ago

@lukecavanagh I can obviously use find&replace via pypMyAdmin or through the admin panel to change the video code. Actually I don't have any issue with my audio files on my site.

What's wrong is that if I type:

[audio:file.mp3]

into my WYSIWYG text editor built in Wordpress, that text (plain-text!) is being stripped from the frontend.

To be more clear, if I type:

[audio is very loud]

into the editor, that string will disappear from the frontend.

#4 follow-up: @lukecavanagh
3 years ago

Does the shortcode still get stripped out if you are using any of the default themes?

#5 in reply to: ↑ 4 @pixel8383
3 years ago

Replying to lukecavanagh:

Does the shortcode still get stripped out if you are using any of the default themes?

Yes it does.

#6 @lukecavanagh
3 years ago

That is really odd, since I did exactly the same thing with a default theme, for example TwentySixteen and it would not strip out the shortcodes.

Where you using the visual or the text editor to add the shortcode?

Note: See TracTickets for help on using tickets.