How to make the WordPress login cookie expire later than 2 weeks

By default, WordPress keeps you logged in for 14 days (if you flag the “Remember me” checkbox).

If you want to change this period to something different, you only have to add these lines to the functions.php of your theme:

add_filter( ‘auth_cookie_expiration’, ‘keep_me_logged_in_for_1_year’ );
function keep_me_logged_in_for_1_year( $expirein ) {
return 31556926; // 1 year in seconds
}

In this case, the cookie will expire in 1 year, so I don’t have to log in every two weeks. If you want the cookie a different period of time, just change that number accordingly (in seconds).

 

Change the default sender on WordPress

By default, WordPress sends notification emails from WordPress <wordpress@yourdomain.tld>.

To change this to something nicer, just add few lines of code on your theme’s functions.php file:

add_filter(‘wp_mail_from’, ‘new_mail_from’);
add_filter(‘wp_mail_from_name’, ‘new_mail_from_name’);

function new_mail_from($old) {
return ‘info@yourdomain.tld';
}
function new_mail_from_name($old) {
return ‘Yourdomain';
}

Clearly, remember to change info@yourdomain.tld and Yourdomain.

 

WordPress and XML sitemaps plugins

If you have a WordPress with multisite feature enabled, you may have experienced problems in finding the right plugin to generate a XML sitemap to submit to search engines.

I usually use Google XML Sitemaps, maybe the most used plugins to generate XML sitemaps on WordPress. Unfortunately, this nice plugin doesn’t work on WP Multisite. And it doesn’t generate multiple sitemaps.

If you want a XML sitemap plugin to generate sitemaps on your multisite wordpress, you want try WordPress SEO by Yoast, as far as i know the only plugin that works well in generating a sitemap on a WP multisite website.

But if you have a huge website, with thousands and thousands of URLs in it, you may have another kind of issue. In fact, none of the above mentioned plugins generate multiple sitemaps (and the sitemap index, of course) in case you have more than 50.000 URLs to list. And by the way, 50.000 is the limit in the protocol, but Google seems not to love sitemaps with more than 10.000 URLs listed. If you have this issue, you should try Strictly Google Sitemap, a plugin that allows to generate multiple sitemaps (and with great performances!). Only problem i found out using this plugin is that the permalink structure must include some numeric value (%post_id%, for example), or the sitemap generated won’t be correct.

And if you have a WP multisite with some of the websites in the network with more than 50.000 (or just 10.000) URLs? I’m afraid we have to wait for it: i couldn’t find any.

WordPress, Feedburner and sitemaps

UPDATE (19/03/2011): it seems the last version of the plugin already takes care of Googlebot, so this post has to be considered outdated.

If you use Feedburner for your wordpress feed, you probably use the FD Feedburner plugin for WordPress . The plugin is cool because it redirects your users to your Feedburner while letting Feedburner itself accessing your wordpress feed; and it’s really simple to configure.

But if you want to submit your feed to Google Webmaster Tools, Google will be redirected to your Feedburner too. While you may expect it to work, in some case it won’t. If you track clicks on Feedburner in fact, your feed will have changed links in it. Feedburner changes the <link>URL</link> to an internal URL that will redirect to your own URL after tracking stuff.

As a consequence, if you submit your feed as a sitemap on Google Webmaster Tools, Google will show you errors like this:

Feedburner and Google sitemap

This happens because the URLs in the Feedburner feed are not into your own domain but on http://feedproxy.google.com/

To fix this behaviour, easiest solution is having Google accessing your original feed (http://yourblog.tld/feed/) instead of being redirect to Feedburner. This can be easily done with a little change in the plugin.

Edit your plugin (with a text editor accessing the file via ftp, or just from the dashboard -> Plugins -> Editor, and select the FD Feedburner plugin) and look for this piece of code:

function feedburner_redirect() {
global $feed, $withcomments, $wp, $wpdb, $wp_version, $wp_db_version;

// Do nothing if not a feed
if (!is_feed()) return;

// Do nothing if feedburner is the user-agent
if (preg_match(‘/feedburner/i’, $_SERVER[‘HTTP_USER_AGENT’])) return;

// Do nothing if not configured
$options = get_option(‘fd_feedburner’);
if (!isset($options[‘feedburner_url’])) $options[‘feedburner_url’] = null;

Just change the line

if (preg_match(‘/feedburner/i’, $_SERVER[‘HTTP_USER_AGENT’])) return;

with:

if (preg_match(‘/(feedburner|google)/i’, $_SERVER[‘HTTP_USER_AGENT’])) return;

and you are done. Google won’t be redirected to your Feedburner feed, and it will use your original feed as sitemap.

Spam of the day

Just got yet another spam. But this one reminded me of a funny quote.

Email’s subject was: Millions of customers can’t be wrong! (and then usual stuff about penis enlargement bla bla bla ;) ).

Well, this is what immediately came in my mind:

(image from Cafepress)

Wassup: the wordpress plugin for real time visitors tracking

Michele just launched Wassup, a nice WordPress plugin to get real time informations about your visitors. Give it a try!

Setting up

Setting up this brand new blog and i’m already having some problem. Nice…

First update: it looks like you have to have at least one post on your post before you can use Feedburner (btw, i’m using this plugin to manage feed stuff), because an empty feed returns a 404 error, even though the feed is there.

Second update: switched to a widgetized theme, because widgets rock.

Third update: of course, i’m using dofollow, a plugin that remove rel=”nofollow” from links in comments. Why would I want nofollow on moderate comments?

Fourth update: and since i’m a lazy ass and i don’t want to play with css to display links better than the theme does, i’m using Link Indication, that does even more.

Fifth update: social bookmarks come with Bookmark Widget.