• Resolved albertvprfy4p3

    (@albertvprfy4p3)


    As somebody said before, the additional pages tab, you can paste your additional pages, but when you press the button, all the contents disappear.

    Ubuntu 22.04.4 LTS, Plesk Obsidian, WordPress 6.5.4, php 8.1.2

    The page I need help with: [log in to see the link]

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter albertvprfy4p3

    (@albertvprfy4p3)

    I forgot! My version of your plugin is 4.5.9.2

    Plugin Author Papin Schipper

    (@papin)

    Hi there,

    Thanks for the report! This issue should be fixed in the next update coming later this week???

    Regards, Papin

    Thread Starter albertvprfy4p3

    (@albertvprfy4p3)

    Hi the new version 4.5.9.3 has fixed the issue of content disappearing, but no matter how you type or paste additional pages, when you press the button, the additional pages appear in a single line, separated by spaces, instead of every page in a line. And obviously the sitemap is not correctly generated. In fact (that is possibly another bug) not additional pages are shown at all when you press “view sitemap”.

    appaulmac

    (@appaulmac)

    @papin I was able to resolve this issue in my local copy of the plugin by:

    1. On save, convert spaces to another character that won’t be in a url (e.g. ‘|'(
    2. On load, explode the string into an array, split by that character.

    I only put this info here for anyone that needs a way to insert a quick fix until the plugin is updated.

    additionalpages.php:

    	if( isset( $_POST["additionalpages"] ) ) {
    $additionalpages = sanitize_text_field( $_POST['additionalpages'] );
    $additionalpages = str_replace(' ', '|', $additionalpages);
    } else $additionalpages = '';
    $wpdb->query( $wpdb->prepare( "UPDATE $table_name SET onoroff = %s WHERE name = 'additionalpages'", $additionalpages ) );

    csg_functions.php:

    // Get addition pages
    function csg_get_additionalpages() {

    global $wpdb;
    $table_name = $wpdb->prefix . "csg_sitemap";
    $pages = array();

    // Enable for major updates
    $configs = $wpdb->get_results( $wpdb->prepare( "SELECT * FROM {$table_name} WHERE name = %s", "additionalpages" ) );
    foreach( $configs as $config ) {
    if( isset( $config->onoroff ) ) {
    $pages = explode('|',$config->onoroff);
    }
    }

    return $pages;

    }

    Also, the date format for the <lastmod> parameter is wrong (According to Google). They want the full ATOM format not just Year-Month-Date. I modified csg_functions.php this way:

    197: 
    <lastmod>'.get_the_modified_date( 'Y-m-d\TH:i:sP', $id ).'</lastmod>';

    Also, the Additional Pages entries don’t get a modified_date like pages or posts do. The output to the sitemap is empty for these: <lastmod></lastmod>.

    Just to make Google stop throwing errors I have set today’s date (whatever day the sitemap is updated) as the date for each extra url:

    227-230:		
    // Additional Pages don't have a modified date. Add today,
    // as Google needs some date, not an empty node
    $md = get_the_modified_date( 'Y-m-d' );
    if($md == '') {
    $md = date( 'Y-m-d\TH:i:sP', strtotime('now'));
    }
    $csg_sitemap_content .= '<lastmod>'.$md.'</lastmod>';
    if( changeFreq() != 'hide' ) $csg_sitemap_content .= '<changefreq>'.changeFreq().'</changefreq>';
    $csg_sitemap_content .= '</url>';
Viewing 5 replies - 1 through 5 (of 5 total)
  • You must be logged in to reply to this topic.