Support » Plugin: The Events Calendar » [Plugin: The Events Calendar] Compatibility with WordPress 3.1 ?

  • Hello,
    I’ve upgrade WordPress to 3.1 today and since this update the plug in The Events Calendar don’t work anymore.
    I’ve change the single.php, list.php etc to fit my theme and put all these files in a folder ‘events’ directly in my theme folder and it always worked but since the update the events page (list) or the calendar work as usual but now when i click on a date the article don’t appear. I just got the excert of the article in the bottom of the events list. It’s like since the update of wordpress 3.1 the page is not considered like an article.
    I tried to change settings in the single.php file but it’s still the same so i’ve disable the plugin.
    Does anyone have the same issue ?
    Thanks for your answers.

Viewing 15 replies - 1 through 15 (of 23 total)
  • Yes, same issue here. When I click on an event in the calendar it shows the correct URL in the address bar but the full calendar is displayed rather than the event post.


    I’ve had the same problem. I’ve been able to confirm that this issue was specifically related to the 3.1 upgrade.

    Apparently this has something to do with the way the plugin is rewriting the permalinks. When I changed my permalink structure to the default ‘Day and name’ or ‘Month and name’ settings it starts to work again.

    Hi Guys

    Same problem here. It is since the upgrade to 3.1 also.

    This is an integral part of my site and I really want this to work.

    If you have any solutions I would love to hear them.

    Can I change only the permalink structure for the events calendar or will this change the whole site.
    I use the permalink structure of category and post name at the moment and naturally with over 400 indexed pages I do not want to change this.

    A solution would be good and I am all ears.
    Thanks in advance.

    As joemcgil said, take a look at, it may help.

    Hey w03d – can you elaborate on how you implemented the fix code:
    remove_filter('template_redirect', 'redirect_canonical');

    Do you add it to the __construct() function, or where?

    Ryan Boren


    WordPress Dev

    There are many event calendar plugins. Could you link to the one you are using? Also, which permalink structure exhibits the problem? Which web server are you using? Apache, IIS6, IIS7, IIS7.5?

    Hey Ryan, the plugin is actually called ‘The Events Calendar’ – (creative right?)

    I think I’ve narrowed down the issue to the rewrite function that the plugin calls by using add_filter( ‘generate_rewrite_rules’ … (line 335 in the-events-calendar.class.php if you’re looking at the code).

    The actual rewrite function is this:

    public function filterRewriteRules( $wp_rewrite ) {
    			if( $useRewriteRules = eventsGetOptionValue('useRewriteRules','on') == 'off' ) {
    			$categoryId = get_cat_id( The_Events_Calendar::CATEGORYNAME );
    			$eventCategory = get_category( $categoryId );
    			$eventCats = array( $eventCategory );
    			$childCats = get_categories("hide_empty=0&child_of=$categoryId");
    			$eventCats = array_merge( $eventCats, $childCats );
    			$newRules = array();
    			foreach( $eventCats as $cat ) {
    				$url = get_category_link( $cat->cat_ID );
    				$base = str_replace( trailingslashit( get_option( 'siteurl' ) ), '', $url );
    				$newRules[$base . 'month'] 					= 'index.php?cat=' . $cat->cat_ID . '&eventDisplay=month';
    				$newRules[$base . 'upcoming/page/(\d+)']	= 'index.php?cat=' . $cat->cat_ID . '&eventDisplay=upcoming&paged=' . $wp_rewrite->preg_index(1);
    				$newRules[$base . 'upcoming']				= 'index.php?cat=' . $cat->cat_ID . '&eventDisplay=upcoming';
    				$newRules[$base . 'past/page/(\d+)']		= 'index.php?cat=' . $cat->cat_ID . '&eventDisplay=past&paged=' . $wp_rewrite->preg_index(1);
    				$newRules[$base . 'past']					= 'index.php?cat=' . $cat->cat_ID . '&eventDisplay=past';
    				$newRules[$base . '(\d{4}-\d{2})$']			= 'index.php?cat=' . $cat->cat_ID . '&eventDisplay=month' .'&eventDate=' . $wp_rewrite->preg_index(1);
    				$newRules[$base . '?$']						= 'index.php?cat=' . $cat->cat_ID . '&eventDisplay=' . eventsGetOptionValue('viewOption','month');
    		  $wp_rewrite->rules = $newRules + $wp_rewrite->rules;

    The only time this breaks is when permalinks have been set to include the category name in the URL (i.e. /%category%/%postname%).

    Ryan Boren


    WordPress Dev

    A change in 3.1 is tripping up the plugin’s in_event_category( ) function. 3.1 now sets the ‘cat’ query var when resolving /%category%/%postname%/ permalinks. 3.0 did not.

    A quick fix is to change this block of code in in_event_category():

    if( $cat_id == $this->eventCategory() ) {
    return true;

    to this:

    if( !is_singular && $cat_id == $this->eventCategory() ) {
    return true;

    We’ll look at fixing this in WP for 3.1.1.

    @ryan – you rock! Thanks so much.

    Ryan Boren


    WordPress Dev

    Ryan –
    re: quick fix
    What file is the above block of text found in?

    Thanks Ryan,

    That fixes the issue with single post pages but doesn’t fix (what I assume is a related issue) with ‘previous’ or ‘next’ posts on the list page when the Event plugin is in “pretty URL mode.”

    Turning off that mode fixes the issue and will work for now until things get patched up.

    @dcdblu – the line Ryan edited above is in the plugin file /the-events-calendar/the-events-calendar.class.php on line 684.

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘[Plugin: The Events Calendar] Compatibility with WordPress 3.1 ?’ is closed to new replies.