RSS feed doesn't validate - wordpress

I get this error on my default WordPress feed: pubDate must be an RFC-822 date-time: Mon, 30 Nov -0001 00:00:00 +0000
Anything inherently evil in pubDate? And if so how to solve the problem?

If you look at the two occurrences of the error from Feed Validator, it's only happening because of the oldest two posts in the feed. Every post after that has the correct pubdate specification. WordPress itself follows the specification, but those two posts are missing the year.
This answer might be of use, as it's what's occurring in your posts
There are 4 dates stored for each WP post: Post_date, post_date_gmt,
post_modified and post_modified_gmt. I recommend you to insert the
same date for both post_date and post_modified and see if it works.
That worked, thanks! It was just the post_date_gmt field that needed
to be set.
If it's just those two, you can manually edit them in the wp_posts table in your database if you feel comfortable doing so, or there are various plugins available that can help with doing such a thing.
PSA: Always have a backup of your database before fiddling with it.

Upgrage your plugins with newer version here https://wordpress.org/plugins/wordpress-seo/
because there is a bug
https://github.com/Yoast/wordpress-seo/issues/525
but if it has not been solve your problems, then better you remove this two post
your.url/cliff-diving-boracay-philippines
your.url/bora-bora-activities-snorkeling-hibiscus
or make new version of those.

Try this .. might work
Go into your wp-includes directory and edit the feed-rss2.php file.
Replace this (line no : 89):
<pubDate><?php echo mysql2date('D, d M Y H:i:s +0000', get_post_time('Y-m-d H:i:s', true), false); ?></pubDate>
With this:
<pubDate><?php echo mysql2date('r', get_the_time('Y-m-d H:i:s')); ?></pubDate>
And also try to update the Post for which the date is wrong :
post ID = 17624 and 17637 or see the published date of these posts in edit screen

Related

ACF : date ISO to Timestamp don't give the right minutes

I'm currently doing a website with ACF plugin. I get some data from an API (I have a json result).
In this result, I get this 2019-05-02T09:00:00Z. I need to add this into my ACF field. This is almost working thanks to the strtotime() function.
But instead of having this result : 02/05/2019 09:00, I have this one : 02/05/2019 09:05
What adjustment should I make to fix that (it's a Wordpress site, so in PHP only please) ?
Edit : my ACF function :
update_field('field_5bcce1711c3d5', $arrayParam["end"], $eventIdDB);
I've seen on forum that ACF is working with unix timestamp

Transferring Umbraco Site to Wordpress, keep same url/permalinks?

We're moving a site from Umbraco to Wordpress and need to find a way to convert the URLs so they still work. The permalink of the Umbraco site is blog/posts/2015/may/ which doesn't work with Wordpress as, although you can create custom permalinks, you can't get the month name in there, only the month number - so it would be blog/posts/2015/05/ and not the month name May.
If there's not an easy way through Wordpress, how can I rewrite urls to change the month name to the month number?
Please help!
you can try the php function get_month_link
And then just split it with explode
Example:
<?php $date = get_month_link('2004', '10');
$MandY= explode(" ", $date );
echo $MandY[0]; // October
echo $mMandY[1]; // 2004
?>
Reference:
here
I was able to recreate the correct URLs with the following combination of tags under Permalinks > Custom structure:
/blog/posts/%year%/%monthname%/%postname%/

Automatically close comments on articles older than X days also hides comments

I am using WordPress 4.0.
My goal is to disable new comments on posts that are older than 14 days, but still have existing comments, that were made in the allowed time frame, be visible.
In Settings->Discussion, there is an option to "Automatically close comments on articles older than x days". I have selected this option, and set x to be 14 days.
I thought this would simply close comments on posts older than 14 days , but it is also hiding the comments for posts older than 14 days.
I have checked the theme's comments.php file, and I don't see anything that would indicate that it is the theme that is hiding the comments.
I am relatively new to Stack Overflow. I have googled this question all day, and searched Stack Overflow, and cannot find an answer. So I guess my question is, if the code that is causing this behavior is not in comments.php, where would it be?
Thank you.
If you want to disable comments on your posts after specific number of days, you can use this code for the purpose. Put this code in your theme's functions.php file.
<?php function autoclose_comments() {
global $wpdb, $tableposts;
if (!isset($tableposts))
$tableposts = $wpdb->posts;
$age = '21 DAY';
$date = $wpdb->get_var("SELECT DATE_ADD(DATE_SUB(CURDATE(), INTERVAL $age), INTERVAL 1 DAY)");
$wpdb->query("UPDATE $tableposts SET comment_status = 'closed' WHERE comment_status = 'open' AND post_status = 'publish' AND post_date < '$date'");
}
You can set $age as per your requirement.

Passing arguments to WordPress feed URL

As we all know the WordPress' feed url is www.mysite.com/feed.
I have edited the feed-rss2.php file to show thumbnails if a certain GET parameter is passed. See the code below:
<?php if($_GET['c'] == 'detailswiththumb') echo the_post_thumbnail( array(100,100) ); ?>
But when I open the feed address like this:
www.mysite.com/feed?c=detailswiththumb
The code doesn't work. Can the arguments be passed this way? Am I missing something? Please help.
Firstly, the function is get_the_post_thumbnail() not the_post_thumbnail().
Then, their is one more problem in your code, that you have to pass the post id to get its thumbnail (for more info see http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail).
So, first you will have to extract the post id from somewhere and then only you would be able to get the thumbnail. But, I think it would be very tough, so try giving up this thought, for it would take you a lot of time and no living being is going to access that path.
There were browser cache issues. Even with Google Chrome's incognito window. Had to test it with passing fake arguments like...
www.mysite.com/feed?c=detailswiththumb&fakearguments=123
...to clear the cache. And the code is fine.
Sorry for wasting your time guys.

Custom feeds action in WordPress blog

I want to use WordPress for my blog. I will install it in my local machine. I know that it has RSS feeds with links. But I have 2 confused problems.
When my number of feeds is very big, assume 10.000.000. I want to limit the number of results when load RSS feed with a request's format as:
http://[myblog_domain]/[rss_name]?limit=25
to limit to top 25 results. May be 25,30, 40, ... or any integer for the limit parameter. Are there any way to do that?
Another problem, I want to load a range of RSS items with a request's format as:
http://[myblog_domain]/[rss_name]?from=31&count=10
to load 10 RSS items begining from the 30th one. May be any integer for the 2 parameters: from, count. Are there any way to do that?
Thank you!
UPDATE 1: about limit parameter
I see there's one while loop in the feed_rss2.php file with the format as:
while ( have_posts() ) : the_post();
// Your loop code
endwhile;
It iterate the post. It already has the limit referring to admin's setting section in the web: Setting / Reading / Syndication feeds show the most recent
I guess that I need to modify this iteration to fit my expectation when the url is passed the parameter (limit = 25, assume) .
How can I do it? Thank you!
UPDATE 2: Or Are there any plugins of this purposes?
Yes you can do that in wordpress, read below article first
http://codex.wordpress.org/Customizing_Feeds\
So you can modify the rss output template and dealing with the arguments

Resources