Support » Plugin: Import YouTube videos as WP Posts » Playlist Pagination

  • I was having issues loading the secondary page of a playlist, until I changed line 91 of the script.js file in your plugin from

    if (ajaxGetYoutube.queryType === 'playlist' && ajaxGetYoutube.nbPage === 0) {


    if (ajaxGetYoutube.queryType === 'playlist' && ajaxGetYoutube.nbPage > 0) {

    – thought you might like to know!

    • This topic was modified 2 years, 7 months ago by rynokins.
Viewing 5 replies - 1 through 5 (of 5 total)
  • Another useful change to the admin.php page – line #120, from

    <option value="<?php echo $user->ID; ?>" <?php if(esc_attr( get_option('yt_to_posts_author') ) === $user->ID){ echo 'selected'; } ?> ><?php echo $user->display_name; ?></option>


    <option value="<?php echo $user->ID; ?>" <?php if( strval($user->ID) === get_option('yt_to_posts_author')){ echo 'selected="selected"'; } ?> ><?php echo $user->display_name; ?></option>

    Reason for this change: the selected WordPress user was not showing up in the select box after save, even though the yt_to_posts_author value was correctly changed and saved.

    One more: change line #158 in script.js from

    jQuery('#loadMore, #approveAllBtn').addClass('hidden');



    so that the ‘Approve all listed videos’ button is not hidden upon loading a secondary page of videos.

    Also – for

    $youtube->playlistItems->listPlaylistItems('snippet', $args);

    the videoId doesn’t need to be parsed out of the image url like so:

    $pattern = '/\/vi\/(.*)\//';
    preg_match($pattern, $newResult['thumb_url'], $matches, PREG_OFFSET_CAPTURE, 3);
    $newResult['id'] = $matches[1][0];

    – you can simply access it under


    Plugin Author enguerranws


    Hi @rynokins,

    Thanks for pointing this up. I’ll will take a look into all of this for the next update.

    Best regards,

    I don’t know why you put a plugin that doesn’t work well!!!
    Next time try to debug before!!

    Thank you so much @rynokin, you saved my day

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Playlist Pagination’ is closed to new replies.