appaulmac
Forum Replies Created
Viewing 3 replies - 1 through 3 (of 3 total)
-
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>';@papin I was able to resolve this issue in my local copy of the plugin by:
- On save, convert spaces to another character that won’t be in a url (e.g. ‘|'(
- 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;
}Forum: Fixing WordPress
In reply to: Site move between servers, serialize dataThanks for the quick response. I’ll have a dig around.
Viewing 3 replies - 1 through 3 (of 3 total)