Archived topic
Last updated date problems
13 replies · Started by theenic on July 12, 2021
Hey there,
I hope you're doing fine.
I have a question regarding the dates; for example, If I scheduled 10 plus articles from 12th to 22nd July, the last updated date overwrites the actual published date I decided my article in the schedule to post on.
So, if the published date is 22nd July, the modified or last updated date will be one on which day I scheduled the 22nd July article.
Any help in this regard because Google is picking the wrong dates (last updated ones only).
Hey, any updates on this?
Another example is this: https://prnt.sc/1aqzpsy the modified date is old while the published date is new but Google is picking the old one. The one on which I decided to schedule my articles.
Any luck?
Hi there,
its seems oru reply to your original topic didn't submit correctly - apologiges for that.
Have a look at this topic - i believe its the same issue:
I've added the code in my function.php file.
// Scheduled posts should update modified date when published
function update_modified_date_to_post_date( $post ) {
$updated_data = [
'ID' => $post->ID,
'post_modified' => $post->post_date,
'post_modified_gmt' => $post->post_date_gmt
];
wp_update_post( $updated_data );
}
add_action( 'future_to_publish', 'update_modified_date_to_post_date', 10, 1 );
The same code. I Will let you know afterward as my scheduled article will be published today late at night. I will come back to you again.
Thank!
Fingers crossed :)
Glad to be of help
Hey there again,
The code above worked, but I'm facing another problem that I think is because of the code I've added.
I'm using Kadence blocks spacer (divider) with 6px height, and whenever I scheduled an article and see the post after that, it's randomly adding 60px spacing, which is the default by that plugin.
And when I open that article to check it shows the following error I attached below.
https://prnt.sc/1bvmnzq
Looking forward
????
You would need to ask Kadence support about that - the code i provided above is a WP Core function not GP, and GP doesn't interfere with how the editor handles core blocks or 3rd party blocks.
Hey again!
I am facing this problem again after the new update.
The scheduled articles are just broken.
I’m using Kadence blocks spacer (divider) with 6px height, and whenever I scheduled an article and see the post after that, it’s randomly adding 60px spacing, which is the default by that plugin.
And when I open that article to check it shows the following error which I've attached below.
https://prnt.sc/nRZQJ27xUAZc
https://prnt.sc/1bvmnzq
Hi Theenic,
Try adding this in Appearance > Customize > Additional CSS:
.entry-content > [class*="wp-block-"]:not(:last-child), h2 {
margin-bottom: 0px;
}
Hey there!
I've added that code into the CSS but after that, the spacing between the image block and text got 0px which I corrected by using this code
.wp-block-image img {
margin-bottom: 1.5em;
}
Afterward same happened with the H3s, H4s, H5s, and H6s and I edited your code like this to fix them:
.entry-content > [class*="wp-block-"]:not(:last-child) h2 {
margin-bottom: 1.5em;
}
.entry-content > [class*="wp-block-"]:not(:last-child), h2 {
margin-bottom: 0px;
}
.entry-content > [class*="wp-block-"]:not(:last-child) h3 {
margin-bottom: 1.5em;
}
.entry-content > [class*="wp-block-"]:not(:last-child), h3 {
margin-bottom: 0px;
}
.entry-content > [class*="wp-block-"]:not(:last-child) h4 {
margin-bottom: 1.5em;
}
.entry-content > [class*="wp-block-"]:not(:last-child), h4 {
margin-bottom: 0px;
}
.entry-content > [class*="wp-block-"]:not(:last-child) h5 {
margin-bottom: 1.5em;
}
.entry-content > [class*="wp-block-"]:not(:last-child), h5 {
margin-bottom: 0px;
}
.entry-content > [class*="wp-block-"]:not(:last-child) h6 {
margin-bottom: 1.5em;
}
.entry-content > [class*="wp-block-"]:not(:last-child), h6 {
margin-bottom: 0px;
}
I've added both identical codes to solve the headings where there are spacing issues by using your code and added the same code to solve headings where I've got issues with your code 0px to add spacing like it was before.
Please do let me if I am right with these codes or not?
The last thing, is about this block please check the screenshot: https://prnt.sc/CIVdfqEu9C79
The spacing is not working here anymore with these codes. Can you please help with this one too?
P:S with your code the correct spacing elements are broken now:
https://prnt.sc/nFXbd38QQzry
https://orah.co/videography-terms/
Technically, it's not broken because of the code. You just have different height values for your spacers which causes the issue. Try correcting them through your plugin.
Alternatively, to totally avoid this issue, why not use a GenerateBlocks Container Block instead as a spacer or the default WordPress spacer.
If you don't want to use GenerateBlocks or the default WP spacer, can you remove all the code we just added. You'll need to set the heights through your plugin, and that should fix the issue.