Comments (13)
released just now :)
thanks for reporting & insisting! :-)
from wp-youtube-lyte.
probably :-)
can you try this code snippet;
add_filter( 'lyte_content_preparse',
function( $in ) {
return str_replace( 'https://www.youtube.com/shorts/', 'https://www.youtube.com/watch?v=', $in );
}
);
from wp-youtube-lyte.
@futtta thank you for your reply. I'm sorry but it not works. I find this link into the output on frontend:
httpv://www.youtube.com/watch?v=shorts/RN29WKHeMDs
from wp-youtube-lyte.
strange ... how exactly did you add the short to a page/ post?
from wp-youtube-lyte.
I pasted this link https://www.youtube.com/shorts/RN29WKHeMDs into the editor of a post. After updating it I still see this httpv://www.youtube.com/watch?v=shorts/RN29WKHeMDs
on the final output. I always see this strange output, before and after adding your custom filter into the Wordpress theme functions. Thank you again for your reply and please tell me if I can provide you more information! 😊
from wp-youtube-lyte.
still strange, as I did the same thing (add the link in the editor) and it worked out of the box (even without the code snippet) ... Are you using a pagebuilder (Elementor/ Beaver Builder/ ...) or WordPress blocks (Gutenberg) or the classic editor?
from wp-youtube-lyte.
@futtta I use classic editor. I try again in a Wordpress clean installation and I'll get back to you with more information. Thank you!
from wp-youtube-lyte.
@futtta sorry for my delay. I tested the bug into a Wordpress clean installation with this details:
- WordPress 6.0.2
- Theme Twenty Twenty-Two 1.2
- Plugin Classic Editor 1.6.2
- Plugin WP YouTube Lyte 1.7.19
Everything updated at the last version. I'm still reproducing the problem. I create a new post, paste a lorem ipsum text, after a "shorts" YouTube video link like this and after a lorem ipsum text again. This is the frontend result:
I have this setting on WP YouTube Lyte:
I tried to fix using a similar solution like your filter into this reply and I resolved the problem with this snippet:
add_filter( 'lyte_content_preparse',
function( $in ) {
return str_replace( 'httpv://www.youtube.com/watch?v=shorts/', 'httpv://www.youtube.com/watch?v=', $in );
}
);
So, I think that into your code flow something do a pre-parse and it breaks the URL. With this filter (using a correct search parameter), I solve the problem and now I have this result:
Can you check it please and (if this is correct for you), can you release an update of your plugin? Thank you so much! 😊
from wp-youtube-lyte.
I'm officially confused now; I set up a new site, same setup (theme & plugins including classic editor) and the short appears immediately, no code snippet needed.
With some additional echo'ing I saw that WordPress' oEmbed logic automatically changes the URL from https://www.youtube.com/shorts/RN29WKHeMDs
into https://youtu.be/RN29WKHeMDs?feature=oembed
which LYTE knows and acts upon, which explains why (for me at least) it worked out of the box ..
So I thought you must have disabled oEmbed, so I disable oEmbed (using code snippet from https://wordpress.stackexchange.com/a/267150) to test, but then I see the original https://www.youtube.com/shorts/RN29WKHeMDs
as URL, which LYTE does not handle by default. At that point the following code snippet (almost the same as the original one) makes things work;
add_filter( 'lyte_content_preparse',
function( $in ) {
return str_replace( 'https://www.youtube.com/shorts/', 'httpv://www.youtube.com/watch?v=', $in );
}
);
But I have not been able to get httpv://www.youtube.com/watch?v=shorts/RN29WKHeMDs
I'm afraid and looking at the code I don't understand how that would happen? :-/
from wp-youtube-lyte.
@futtta I finally understood the problem! I test your code with a PHP live debugger and I found the exact point where your code generate the URL httpv://www.youtube.com/watch?v=shorts/RN29WKHeMDs
. So I searched into your github source the same point for showing it to you but when I compare the 2 functions I find some differences! Your 1.7.19
on Github (for the file wp-youtube-lyte.php
) is different from the 1.7.19
installed from Wordpress marketplace. This is the final DIFF:
https://www.diffchecker.com/aukzFyZM
Finally I did a "crazy monkey test" and I copy the source of the Github wp-youtube-lyte.php
into my local source of the clean installation of Wordpress and.... magic! It works and I have the same behavior of yours! So please can you synch your Github version with Wordpress marketplace and release it please? It is very important for me. Thank you so much! 😃
PS. I attach a screenshot of the interested part of the diff, too:
from wp-youtube-lyte.
from wp-youtube-lyte.
@futtta Perfect! So I await the update! Thank you so much for your kindness 😄
from wp-youtube-lyte.
released just now :)
thanks for reporting & insisting! :-)
Good! I am happy to have made my contribution! Thank you, too! 😄
from wp-youtube-lyte.
Related Issues (20)
- lyteThumbs.php; limit requests? HOT 1
- review (remove) deprecated params?
- .hidden should be .lyte .hidden?
- make notice about YT API dismissable HOT 1
- dash -> double issues? HOT 2
- Alignment options from Gutenberg and "Additional CSS classes" are ignored HOT 11
- support end parameter
- add title to noscript image?
- Remove inline fixed widths HOT 3
- Thumbnail Cache dir is not created automatically anymore HOT 3
- Your API key might be OK, but the API call did not succeed or the response was not entirely expected. Technical error: forbidden HOT 1
- double dash in code blocks replaced by unicode dash HOT 1
- Short urls in Elementor don't work HOT 7
- issue with new lazyload feature? HOT 21
- Save video thumbnails in webP format? HOT 4
- Regex misses figcaption HOT 2
- youtube live stream url breaks
- Allow use of youtube-nocookie.com domain optional HOT 1
- Dismiss API key notification HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from wp-youtube-lyte.