Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Youtube shortcode stopped working after upgrading to WordPress 4.4 #3121

Closed
richardmtl opened this issue Dec 9, 2015 · 39 comments · Fixed by #3127
Closed

Youtube shortcode stopped working after upgrading to WordPress 4.4 #3121

richardmtl opened this issue Dec 9, 2015 · 39 comments · Fixed by #3127
Assignees
Labels
[Feature] Shortcodes / Embeds [Type] Bug When a feature is broken and / or not performing as intended
Milestone

Comments

@richardmtl
Copy link
Contributor

Several reports in the forums:

https://wordpress.org/support/topic/youtube-shortcode-no-longer-working-after-updating-to-44?replies=10#post-7755539
https://wordpress.org/support/topic/youtube-shortcode-stopped-working-with-wp-44?replies=5

I confirmed with this shortcode:

[youtube=https://www.youtube.com/watch?v=zbn5_3yf6VQ&w=660]

@richardmtl richardmtl added [Type] Bug When a feature is broken and / or not performing as intended [Feature] Shortcodes / Embeds labels Dec 9, 2015
@richardmtl richardmtl added this to the Needs Triage milestone Dec 9, 2015
@kraftbj
Copy link
Contributor

kraftbj commented Dec 9, 2015

Caused by https://core.trac.wordpress.org/changeset/34747 per git bisect

Looks like Core no longer trips on the [shortcode=something] style, which it still did in 4.3.1.

@kraftbj
Copy link
Contributor

kraftbj commented Dec 9, 2015

I can't tell if 34747's breaking of the format was intentional or not per the Shortcode Roadmap. Opened https://core.trac.wordpress.org/ticket/34939 to get a clarification/report it.

@kraftbj kraftbj modified the milestones: 3.8.2, Needs Triage Dec 9, 2015
@pilarmonge80
Copy link

Hello,

I can't see any video from my blog.

I only see de the shortcode for example [youtube=https://youtu.be/IGrqiSYc1oM&w=600&h=440] in my post http://postresoriginales.com/pastel-de-naranja/ and i have more than 200 pages with this shortcode for YouTube

shortcode

Also I inserted your code [youtube=https://www.youtube.com/watch?v=zbn5_3yf6VQ&w=660] and i don't see anything
shortcode 02

Thanks

@kraftbj
Copy link
Contributor

kraftbj commented Dec 9, 2015

Hi @pilarmonge80 - your issue is the one being discussed in this ticket. WordPress 4.4 stopped processing shortcodes built like that (e.g. [youtube=http://something]), though unintentionally. We're working toward determining best path forward.

For an immediate fix, you can update to [youtube url=http.....] instead. If you feel able to do so, inclusive of creating and restoring backups, you can search and replace for [youtube= to [youtube url= in your db (using a plugin, or something else). Again, please don't do this unless you are able to recover if the search and replace breaks something.

@pilarmonge80
Copy link

Thanks @kraftbj I'll wait because I find myself unable to make that change :)

@kraftbj
Copy link
Contributor

kraftbj commented Dec 10, 2015

While https://core.trac.wordpress.org/ticket/34939 is still in play, we should start preparing a PR to do an early filter on the_content to str_replace to a proper shortcode. I'm not sure we'll be able to help the further edge cases if anyone used a shortcode outside of the_content somehow.

Also noting the en.support docs need to be updated as they have this format all over the place. :)

@Musicuratum
Copy link

Do you happen to know yet whether the Youtube shortcode will be reinstated in the same form -- and when? Likewise I have used it a great number of times on my website, and should very much prefer to avoid having to change all that code.

@kraftbj
Copy link
Contributor

kraftbj commented Dec 10, 2015

@Musicuratum - Details will be posted here as they're known. Long-term, it is probably best to not use this format (rather [youtube url= format or simply paste the URL directly in as it'll auto-embed without the need of a shortcode).

Per my comment above, we'll likely have a shim to convert, on display, the [youtube= style to the standard format. Timeline TBD.

@Musicuratum
Copy link

Of course I won't be using that shortcode again -- unless it's simply reinstated. For all the instances when I have used it, however, I'm waiting eagerly for your solution. All the more as it was the official Jetpack shortcode and as such abandoned without notice. (Given that I modify several of the parameters, embedding YT works best, I've found, with a shortcode, as opposed to simply including the URL on its own line.)

@kraftbj
Copy link
Contributor

kraftbj commented Dec 10, 2015

@Musicuratum - It wasn't abandoned, as much as an unintended change upstream by WordPress led to it no longer being seen as a shortcode. We'll figure out something so you're not stuck. But, in any case, I would suggest using [youtube url=http://example.com] format over [youtube=http://example.com].

@Musicuratum
Copy link

For the moment I don't have any YT materials to embed, fortunately. Yes, when I do, I'll use that other shortcode. Do you happen to know when the documentation concerning it and its various possible parameters will be written?

@kraftbj
Copy link
Contributor

kraftbj commented Dec 10, 2015

It's the same shortcode. Same exact behavior. https://en.support.wordpress.com/videos/youtube/

@Musicuratum
Copy link

Very well, I see that that page has been updated -- earlier it provided the shortcode I've been using.

Please do let me know when the solution for dealing with the now deprecated one is ready.

@pilarmonge80
Copy link

Thank you for being looking for a solution because I do not feel able to enter the code to put the patch :)

@darrenbrett
Copy link

I assume it's known that this goes beyond just YouTube shortcode. I use the popular Starter theme in various places, and it's shortcode functions are also broken with 4.4.

@kraftbj
Copy link
Contributor

kraftbj commented Dec 11, 2015

@darrenbrett - For the broader conversation, see https://core.trac.wordpress.org/changeset/34747 . This format is non-standard, though, so we're going to work toward not using them here on out.

@pilarmonge80
Copy link

Sorry @kraftbj but I do not hear . If you have already prepared a patch why not directly upload that file to modify it with FILEZILLA .
Or do we have to get into those files to write the new code.
Thanks :)

@jeherve
Copy link
Member

jeherve commented Dec 11, 2015

@pilarmonge80 The patch is available here:
https://github.com/Automattic/jetpack/pull/3127/files

If you don't feel comfortable editing PHP files yourself, I'd suggest joining Jetpack's Beta group and installing the Beta plugin. You will then get to test the patch as soon as we release a Beta for the next version of Jetpack, 3.8.2. It should happen in the next few days.

@pilarmonge80
Copy link

thanks @jeherve

I've change the two files functions.compat.php and modules/shortcodes/youtube.php but now i don't see the videos again.

Have I change more codes??

@dereksmart
Copy link
Member

@pilarmonge80 on the front-end of your site, are you seeing the shortcode text or nothing at all?

Could you please paste the exact shortcode you're using? Thanks!

@pilarmonge80
Copy link

Hello @dereksmart

I have this type of code in more than 200 pages in my blog
[youtube=https://youtu.be/IGrqiSYc1oM&w=600&h=440]

And I see this
shortcode

@jeherve
Copy link
Member

jeherve commented Dec 11, 2015

@pilarmonge80 Could you try the following:

  1. Go to the Plugins menu in your dashboard, deactivate Jetpack, and then delete it.
  2. Go to Plugins > Add New > Upload, and upload and install this version of Jetpack:
    http://i.wpne.ws/e3YB
  3. Once activated, go to the Jetpack menu and connect Jetpack to your WordPress.com account again.

Let us know how it goes.

@dereksmart
Copy link
Member

It's worth noting that the link to https://youtu.be/IGrqiSYc1oM&w=600&h=440 is a 404, which is probably why it's not showing. I tested it in WordPress 4.3.1 and no luck there either.

@dereksmart
Copy link
Member

When I remove the width and height arguments, it works ok

@dereksmart
Copy link
Member

I don't think the youtu.be urls work with parameters. When I use [youtube=https://www.youtube.com/watch?v=IGrqiSYc1oM&w=600&h=440] it works ok

@pilarmonge80
Copy link

@jeherve I've done the three steps and go on whatching only the code like [youtube=https://youtu.be/IGrqiSYc1oM&w=600&h=440]
Have I do something else?
Regards,

@dereksmart I wrote the shortcode for whatching the video. The last parameters are the width and height. Before the update of wordpress i could see the vide like this
shortcode 03

For whatching now the videos I have to add in the shortcode [youtube url=https://youtu.be/IGrqiSYc1oM&w=600&h=440] but the problem is that i have more than 200 pages.

Regards

@dereksmart
Copy link
Member

thanks @pilarmonge80 working up a patch to look for the shortened youtu.be urls

@pilarmonge80
Copy link

thanks @dereksmart so i have to wait and i don't to change anything, don't I??

@dereksmart
Copy link
Member

yep we will have a patch ready today!

@pilarmonge80
Copy link

Great!!! @dereksmart thanks a lot for being working so much :D

@darrenbrett
Copy link

Just to clarify, will the patch cover the shortcodes issue in general, or just the YouTube issue specifically?

@dereksmart
Copy link
Member

@darrenbrett I believe our youtube shortcode is the only one that we use the [shortcodeName=] syntax, so it's the only one we are aiming to fix for this release.

@dereksmart
Copy link
Member

@pilarmonge80. If you update to the most recent version of this this patch it should work ok now.

this line is what changed from the last patch:

@pilarmonge80
Copy link

Thank you very much @dereksmart and @jeherve I've change the line

$content = preg_replace( '@[youtube=(.*?youtu(be)?.(com|be).+?)]@', '[youtube $1]', $content );

and now everything is ok :)

Have a nice weekend

@dereksmart
Copy link
Member

you as well, thanks for testing :)

@darrenbrett
Copy link

So just to clarify, re: the issues discussed here: https://core.trac.wordpress.org/changeset/34747, will it be up to individual people to update the PHP - or will there be some patching made available via WordPress at some point? Just trying to understand this in terms of the commitment to backwards compatibility as well. Thanks.

@dereksmart
Copy link
Member

I can't speak for the core team ATM, but afaik they have no plans to rollback that change and it will be up to theme/plugin devs to update their products to adhere to this change.

https://core.trac.wordpress.org/ticket/34939 would be a good place to ask / follow for more info.

@darrenbrett
Copy link

Okay, thanks.

@BigDave44
Copy link

If it helps, I successfully changed 1,786 instances of [youtube= ...] to [youtube url= ...] on posts going back over 6 years, using the excellent "Search Regex" plugin - and it only took a few seconds.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Feature] Shortcodes / Embeds [Type] Bug When a feature is broken and / or not performing as intended
Projects
None yet
Development

Successfully merging a pull request may close this issue.

8 participants