Youtube shortcode stopped working after upgrading to WordPress 4.4 #3121

Closed
richardmtl opened this Issue Dec 9, 2015 · 39 comments

Comments

Projects
None yet
8 participants
@kraftbj

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 9, 2015

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 9, 2015

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 9, 2015

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

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

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 9, 2015

Contributor

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.

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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 9, 2015

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

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

@kraftbj

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 10, 2015

Contributor

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. :)

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

This comment has been minimized.

Show comment
Hide comment
@Musicuratum

Musicuratum Dec 10, 2015

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.

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

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 10, 2015

Contributor

@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.

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

This comment has been minimized.

Show comment
Hide comment
@Musicuratum

Musicuratum Dec 10, 2015

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.)

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

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 10, 2015

Contributor

@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].

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

This comment has been minimized.

Show comment
Hide comment
@Musicuratum

Musicuratum Dec 10, 2015

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?

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

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 10, 2015

Contributor

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

Contributor

kraftbj commented Dec 10, 2015

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

@Musicuratum

This comment has been minimized.

Show comment
Hide comment
@Musicuratum

Musicuratum Dec 10, 2015

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.

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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 10, 2015

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

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

@darrenbrett

This comment has been minimized.

Show comment
Hide comment
@darrenbrett

darrenbrett Dec 11, 2015

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.

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

This comment has been minimized.

Show comment
Hide comment
@kraftbj

kraftbj Dec 11, 2015

Contributor

@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.

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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 11, 2015

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 :)

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

This comment has been minimized.

Show comment
Hide comment
@jeherve

jeherve Dec 11, 2015

Member

@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.

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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 11, 2015

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??

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

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

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!

Member

dereksmart commented Dec 11, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 11, 2015

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

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

This comment has been minimized.

Show comment
Hide comment
@jeherve

jeherve Dec 11, 2015

Member

@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.

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

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

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.

Member

dereksmart commented Dec 11, 2015

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

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

Member

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

Member

dereksmart commented Dec 11, 2015

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

@dereksmart

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

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

Member

dereksmart commented Dec 11, 2015

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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 11, 2015

@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

@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

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

Member

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

Member

dereksmart commented Dec 11, 2015

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

@pilarmonge80

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 11, 2015

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

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

@dereksmart

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

Member

yep we will have a patch ready today!

Member

dereksmart commented Dec 11, 2015

yep we will have a patch ready today!

@pilarmonge80

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 11, 2015

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

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

@darrenbrett

This comment has been minimized.

Show comment
Hide comment
@darrenbrett

darrenbrett Dec 11, 2015

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

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

@dereksmart

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

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.

Member

dereksmart commented Dec 11, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

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:

Member

dereksmart commented Dec 11, 2015

@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

This comment has been minimized.

Show comment
Hide comment
@pilarmonge80

pilarmonge80 Dec 11, 2015

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

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

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

Member

you as well, thanks for testing :)

Member

dereksmart commented Dec 11, 2015

you as well, thanks for testing :)

@darrenbrett

This comment has been minimized.

Show comment
Hide comment
@darrenbrett

darrenbrett Dec 11, 2015

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.

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

This comment has been minimized.

Show comment
Hide comment
@dereksmart

dereksmart Dec 11, 2015

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.

Member

dereksmart commented Dec 11, 2015

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

This comment has been minimized.

Show comment
Hide comment
@darrenbrett

darrenbrett Dec 11, 2015

Okay, thanks.

Okay, thanks.

@BigDave44

This comment has been minimized.

Show comment
Hide comment
@BigDave44

BigDave44 Dec 11, 2015

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.

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