• Resolved Gustav

    (@4ever16)


    I want to convert youtube links to embeded ones so i can see them directly on my blog.
    The youtube link is printed with <?php echo get_permalink(); ?>

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    no, that’s not how you’d get a YouTube link. That gives you a link to the current page on your site.

    Just paste in the link on a line by itself — something like

    https://youtube.com/watch?v=123456

    and WP will take it from there.

    Thread Starter Gustav

    (@4ever16)

    No i think there is theme problem or just cause i heavily modified the theme.
    I got it working before dont remember the link i was visiting it was long time ago.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    get_the_permalink() has *nothing to do* with youtube.

    This may be a plugin or theme conflict. Please attempt to disable all plugins, and use one of the default (Twenty*) themes. If the problem goes away, enable them one by one to identify the source of your troubles.

    If you can install plugins, install “Health Check”: https://www.ads-software.com/plugins/health-check/ On the troubleshooting tab, you can click the button to disable all plugins and change the theme for you, while you’re still logged in, without affecting normal visitors to your site. You can then use its admin bar menu to turn on/off plugins and themes one at a time.

    See https://www.wpbeginner.com/plugins/how-to-deactivate-all-plugins-when-not-able-to-access-wp-admin/

    Thread Starter Gustav

    (@4ever16)

    It works on other themes. But not on the one im using cause i modified it or something.
    There is some code i can paste in functions.php i remember.

    But instead of <?php echo get_the_content(); ?> im using <?php echo get_permalink(); ?> to get youtube link.

    Moderator Steven Stern (sterndata)

    (@sterndata)

    Volunteer Forum Moderator

    once again, no, that will not work. get_permalink gets a link to the current post or page on your site. So you need to figure out how you broke this in your theme.

    Thread Starter Gustav

    (@4ever16)

    Yes it was a theme problem. Solved now.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Convert youtube links to embed / iframe’ is closed to new replies.