[Plugin: pagebar]Conflict with rss feed (or powerpress)

I’ve been using the pagebar plugin for a long time. I’ve also been using the Powerpress plugin for podcasting. It appears there is some kind of conflict involving permalinks. With pagebar active, my feed/podcasting rss feed returns a not found error. After much trial and error, I’ve found that deactivating pagebar and resetting my permalinks fixes the problem. But, if I reactivate pagebar, it kills my podcast feed again, and I have to reset. Too bad, I like pagebar, but I need my feed!

This one took me a very long time to figure out. Basically, the pagebar plugin, on line 156 of pagebar2.php, is flushing the rewrite rules. The init action for the pagebar2 plugin is set to be -1, which means it loads before any of the other plugin’s init functions. It also means that pagebar is calling flush_rules() every time a page loads in your blog, which is very bad for site performance.

To better explain, your permalinks are saved in the wp_options table under the option_name ‘_transient_rewrite_rules’. The reason is to cache all of the possible valid links that are on your blog so WordPress can more efficiently handle the request. scanning the WordPress core code, the calls to flush_rules() is always made after all of the plugins have initialized and have added all of their required permalinks.

When the pagebar plugin calls flush_rules() before all the other plugins get to initialize, it essentially wipes out the cached possibilities powerpress added to the permalink rules, thus making the feeds added by PowerPress when calling the add_feed() function disappear as you’ve observed.

The bad news, pagebar is adding an additional load to your mysql server. Every time a request comes into your blog, pagebar, by calling the flush_rules function, is going to make your blog perform a write to your database, which if your site has a lot of traffic, can result in very slow page loads. MySQL is fast at reading data from the database, but it is not as fast at writing data to the database.

The even more bad news, every time you are in the admin area of WordPress and a page loads, the pagebar plugin will call flush_rules, which will then call the save_mod_rewrite_rules() function, which rewrites your .htaccess file.

To recap, every page load will result in a record in your database being deleted then re-inserted and when you are in the admin area, your .htaccess file will be rewritten at every page load. Writing to the database is slower than reading, but writing to the file system is even slower.

I would not recommend using the pagebar plugin until the flush_rules is removed from the init function of the pagebar plugin.

The conflict with PowerPress and the pagebar plugin has been resolved in PowerPress 1.0.4. PowerPress now adds the permalink keyword slug name to the rewrite object before pagebar performs the flush function.