• Resolved syrupcore

    (@syrupcore)


    If I turn off permalinks, all works fine. Listing page works fine as well (with or without pretty permalinks).

    With permalinks on, I get a 404. I did a little debugging and here’s what I have:

    permalink structure
    '/%postname%/'
    
    page permastruct
    '%pagename%'
    
    matched rule and query
    '[^/]+/([^/]+)/?$'
    
    matched query
    'attachment=2013-women-achievement-awards'
    
    request
    'event/2013-women-achievement-awards'

    I don’t get why it’s looking for an attachment. Or why the request didn’t match any of these other existing rewrite rules:

    rewrite rules
    array (
      'event/([^/]+)/(\\d{4}-\\d{2}-\\d{2})/?$' => 'index.php?tribe_events=$matches[1]&eventDate=$matches[2]',
      'event/([^/]+)/(\\d{4}-\\d{2}-\\d{2})/ical/?$' => 'index.php?ical=1&tribe_events=$matches[1]&eventDate=$matches[2]',
      'event/([^/]+)/all/?$' => 'index.php?post_type=tribe_events&tribe_events=$matches[1]&eventDisplay=all',
      'events/page/(\\d+)' => 'index.php?post_type=tribe_events&eventDisplay=upcoming&paged=$matches[1]',
      'events/ical' => 'index.php?post_type=tribe_events&ical=1',
      'events/(feed|rdf|rss|rss2|atom)/?$' => 'index.php?post_type=tribe_events&eventDisplay=upcoming&feed=$matches[1]',
      'events/month' => 'index.php?post_type=tribe_events&eventDisplay=month',
      'events/upcoming/page/(\\d+)' => 'index.php?post_type=tribe_events&eventDisplay=upcoming&paged=$matches[1]',
      'events/upcoming' => 'index.php?post_type=tribe_events&eventDisplay=upcoming',
      'events/past/page/(\\d+)' => 'index.php?post_type=tribe_events&eventDisplay=past&paged=$matches[1]',
      'events/past' => 'index.php?post_type=tribe_events&eventDisplay=past',
      'events/(\\d{4}-\\d{2})$' => 'index.php?post_type=tribe_events&eventDisplay=month&eventDate=$matches[1]',
      'events/(\\d{4}-\\d{2}-\\d{2})$' => 'index.php?post_type=tribe_events&eventDisplay=upcoming&eventDate=$matches[1]',
      'events/feed/?$' => 'index.php?eventDisplay=upcoming&post_type=tribe_events&feed=rss2',
      'events/?$' => 'index.php?post_type=tribe_events&eventDisplay=default',
      'event/([^/]+)/ical/?$' => 'index.php?post_type=tribe_events&name=$matches[1]&ical=1',

    Some other plugin settings that may be relevant:
    Events URL slug: events
    Single event URL slug: event
    Skeleton Styles
    No HTML in the before or after Event boxes
    I don’t have anything custom in my .htaccess
    No custom templates in my theme folder
    I have tried saving permalink settings again
    I have tried deactivating/activating the plugin

    Any one have any idea from this info what I’ve wired incorrectly?

    https://wordpress.org/plugins/the-events-calendar/

Viewing 15 replies - 1 through 15 (of 23 total)
  • Thread Starter syrupcore

    (@syrupcore)

    Using the Debug This plugin, I was able to snoop the WP_query. Again, I don’t get why it’s looking for an attachment!

    [query] => Array
            (
                [attachment] => 2013-women-achievement-awards
                [debug-this] => wp_query
            )
    
        [tribe_is_event] =>
        [tribe_is_multi_posttype] =>
        [tribe_is_event_category] =>
        [tribe_is_event_venue] =>
        [tribe_is_event_organizer] =>
        [tribe_is_event_query] =>
        [tribe_is_past] =>
        [request] => SELECT   wp_posts.* FROM wp_posts  WHERE 1=1  AND wp_posts.post_name = '2013-women-achievement-awards' AND wp_posts.post_type = 'attachment'  ORDER BY wp_posts.menu_order, wp_posts.post_date DESC
        [posts] => Array
            (
            )

    πŸ™

    alessiafabbri

    (@alessiafabbri)

    Hi there I’m having the exact same problem. Is it going to be fixed?

    Thread Starter syrupcore

    (@syrupcore)

    If I disable all plugins, it works. Turning them all on one by one until it breaks again but its different plugins each time and I have yet to find a pattern within any of them that causes it to break.

    On my local instance, I did some mojo shuffle of enabling/disabling plugins, saving calendar settings and saving permalinks settings that has it working just fine – with all plugins on.

    I don’t expect you guys to fix this for me but a clue as to what might be causing it so that I can investigate on my own would be very much appreciated.

    Thread Starter syrupcore

    (@syrupcore)

    Is it possible to turn off permalinks for events only? That’d be fine with me for now!

    Thread Starter syrupcore

    (@syrupcore)

    Can’t edit a previous post but with regards to enabling/disabling plugins/mojo… I had it working in my local instance, enabled a a part of plugin that broke it (which registered custom post types), disabled that section of the plugin again and it is still not working. I have no idea how to debug this.

    Back to one of my original questions… Any idea why it’s matching for attachments when tribe events are their own post type?

    Just to be sure I don’t have some conflicting CPT I ran:

    mysql> select id, post_name, post_type, post_status from wp_posts  where post_type LIKE '%event%';
    +------+----------------------------------+--------------+-------------+
    | id   | post_name                        | post_type    | post_status |
    +------+----------------------------------+--------------+-------------+
    | 4655 | test-event                       | tribe_events | draft       |
    | 5470 | awards-party-2014                | tribe_events | publish     |
    | 7202 | local-hero-awards-ceremony       | tribe_events | publish     |
    | 8621 | oregon-berry-festival            | tribe_events | publish     |
    | 8625 | oregon-berry-festival-2          | tribe_events | publish     |
    | 8627 | struktur-event                   | tribe_events | publish     |
    | 8630 | 2013-women-of-achievement-awards | tribe_events | publish     |
    +------+----------------------------------+--------------+-------------+
    11 rows in set (0.01 sec)
    Brook

    (@brook-tribe)

    Syrupcore and Alessiafabbri, you guys are the only two people I have seen thus far with this problem. Perhaps there is commonality between your two installs that we can find, and thus narrow down the probable cause. Would you each mind posting a list of plugins that you are running? If you are both running a custom post_type plugin, that could definitely be the problem.

    The more info y’all can share, the more likely we are to find that plugin or whatever that might be the root cause. HBopefully it will be easy to spot if we have a list of plugins, but we might have to dive even deeper. Cheers!

    – Brook

    Thread Starter syrupcore

    (@syrupcore)

    Thanks very much @brook. I think I’ve sorted it out but I’ve been fooled before. πŸ™‚ I’ll include what seems to have fixed it but also my plugin list in case it helps @alessiafabbri (or me if it breaks again!)

    Here’s my list:

    Advanced Custom Fields - Version 4.3.4
    Advanced Custom Fields: Code Area - Version 1.0.0
    Advanced Custom Fields: Flexible Content Field - Version 1.1.1
    Advanced Custom Fields: Gallery Field - Version 1.1.1
    Advanced Custom Fields: Repeater Field - Version 1.1.1
    AJAX Thumbnail Rebuild - Version 1.09
    Site Customizations - Version 0.2 ( * mine)
    Write Panel - Version 0.2 (* mine)
    Enable Media Replace - Version 2.9.5
    Force Regenerate Thumbnails - Version 2.0.3
    Manual Image Crop - Version 1.04
    Post Types Order - Version 1.6.8
    Relevanssi - Version 3.3.4
    Term Management Tools - Version 1.1.3
    The Events Calendar - Version 3.5.1
    Theia Smart Thumbnails - Version 1.2.1
    UberMenu 2 - Version 2.4.0.3
    WordPress SEO - Version 1.5.2.5
    WP Retina 2x - Version 1.9.2

    Within my Site Customizations Plugin I create about 9 CPTs using this class. What seemed to have caused the problem was this class was registering the post types on the WP’s init action with a priority of 10 (Github link) while The Event Calendar’s add_hooks method did the same add_action( 'init', array( $this, 'init'), 10 ); on line 338 of /lib/the-events-calendar.class.php which in turns calls register_post_types.

    If I set my CPT’s init hook to priorty 11, all is well in WP land. Huzzah! What I don’t yet understand is why it’s important for Tribe to be first! If I set mine to 9 or Tribe’s to 20, I get the 404s and the attachment weirdness again. In the interest of learning and avoiding days of face planting in the future, I’d really love to understand the why behind this.

    If I add this to my footer

    global $wp_query;
    var_dump($wp_query->query_vars);

    point my browser at “http://localhost/event/struktur-event/” and don’t set Tribe to a higher priority I get this out (snipped)

    array(61) {
      ["attachment"]=>
      string(14) "struktur-event"

    And, just to be clear, everything else about The Events Calender still works in this state. The admin, the list page, the calender… just no single event pages. Additionally, according to Debug This->Post Types->All Post Types the tribe_events post type is registered. Obviously, the adding events in the admin wouldn’t work if this weren’t the case. So what’s with the attachment post type??

    If I ‘fix’ the priorites, var_dump returns what I’d expect (snipped).

    array(65) {
      ["page"]=>
      int(0)
      ["tribe_events"]=>
      string(14) "struktur-event"
      ["post_type"]=>
      string(12) "tribe_events"

    Finally, when I print out the tribe_events CPT object with either priority setting, they are identical.

    Seems like perhaps it doesn’t actually have to do with the CPTs themselves at all but something about CPTs setting up rewrite rules? I did experiment with flush_rewrite_rules at various stages with no luck until I found the priority thing.

    Thanks for any insight.

    ———————————————–
    PS. A generated the active plugin list by clicking on ‘active’ in the admin menu and then running the following in my console. Included here in case it helps anyone else get their list up!

    jQuery('.plugin-title').each(function(){
        var name, version;
    
        name = jQuery(this).find('strong').text() ;
        version = jQuery(this).next('td').find('.active').text();
        version = version.split(' | ')
    
        console.log( name + " - " + version[0]);
    
    });
    CoachCoen

    (@coachcoen)

    I get the same thing

    Plug-ins:
    (inactive) Akismet
    Floating social bar
    Social Network Tabs
    The Events Calendar
    (inactive) WordPress Importer

    Let me know if you need anymore info to help fix this. Thanks, Coen

    Thread Starter syrupcore

    (@syrupcore)

    @coachcoen

    Can you add this to your footer.php template please (or wherever is clever) and report back what it prints out?

    <?php
    global $wp_query;
    echo '<pre>';
    var_dump($wp_query->query_vars);
    echo '</pre>';
    ?>

    Mostly curious to see if you’re getting ‘attachment’ too.

    CoachCoen

    (@coachcoen)

    With permalinks on, on the home page (since I can’t see the event page when permalinks on), this gives the following:

    (let me know if you need something else)

    array(61) {
    [“error”]=>
    string(0) “”
    [“m”]=>
    string(0) “”
    [“p”]=>
    int(0)
    [“post_parent”]=>
    string(0) “”
    [“subpost”]=>
    string(0) “”
    [“subpost_id”]=>
    string(0) “”
    [“attachment”]=>
    string(0) “”
    [“attachment_id”]=>
    int(0)
    [“name”]=>
    string(0) “”
    [“static”]=>
    string(0) “”
    [“pagename”]=>
    string(0) “”
    [“page_id”]=>
    int(0)
    [“second”]=>
    string(0) “”
    [“minute”]=>
    string(0) “”
    [“hour”]=>
    string(0) “”
    [“day”]=>
    int(0)
    [“monthnum”]=>
    int(0)
    [“year”]=>
    int(0)
    [“w”]=>
    int(0)
    [“category_name”]=>
    string(0) “”
    [“tag”]=>
    string(0) “”
    [“cat”]=>
    string(0) “”
    [“tag_id”]=>
    string(0) “”
    [“author”]=>
    string(0) “”
    [“author_name”]=>
    string(0) “”
    [“feed”]=>
    string(0) “”
    [“tb”]=>
    string(0) “”
    [“paged”]=>
    int(0)
    [“comments_popup”]=>
    string(0) “”
    [“meta_key”]=>
    string(0) “”
    [“meta_value”]=>
    string(0) “”
    [“preview”]=>
    string(0) “”
    [“s”]=>
    string(0) “”
    [“sentence”]=>
    string(0) “”
    [“fields”]=>
    string(0) “”
    [“menu_order”]=>
    string(0) “”
    [“category__in”]=>
    array(0) {
    }
    [“category__not_in”]=>
    array(0) {
    }
    [“category__and”]=>
    array(0) {
    }
    [“post__in”]=>
    array(0) {
    }
    [“post__not_in”]=>
    array(0) {
    }
    [“tag__in”]=>
    array(0) {
    }
    [“tag__not_in”]=>
    array(0) {
    }
    [“tag__and”]=>
    array(0) {
    }
    [“tag_slug__in”]=>
    array(0) {
    }
    [“tag_slug__and”]=>
    array(0) {
    }
    [“post_parent__in”]=>
    array(0) {
    }
    [“post_parent__not_in”]=>
    array(0) {
    }
    [“author__in”]=>
    array(0) {
    }
    [“author__not_in”]=>
    array(0) {
    }
    [“ignore_sticky_posts”]=>
    bool(false)
    [“suppress_filters”]=>
    bool(false)
    [“cache_results”]=>
    bool(true)
    [“update_post_term_cache”]=>
    bool(true)
    [“update_post_meta_cache”]=>
    bool(true)
    [“post_type”]=>
    string(0) “”
    [“posts_per_page”]=>
    int(10)
    [“nopaging”]=>
    bool(false)
    [“comments_per_page”]=>
    string(2) “50”
    [“no_found_rows”]=>
    bool(false)
    [“order”]=>
    string(4) “DESC”
    }

    Thread Starter syrupcore

    (@syrupcore)

    Ah thanks for posting @coachcoen. That’s sounds a little different from my issue. I could still see the events aggregation pages at /events put couldn’t see individual events at /events/my-event (with permalinks on).

    CoachCoen

    (@coachcoen)

    Actually, it seems to be fixed now. When I added the code to the footer, I disabled and installed a couple of unused plugins at the same time. Unfortunately I don’t remember which ones

    eggplantstudios

    (@shawneggplantstudiosca)

    I had the same issue, it was 404ing and $wp_query was looking for an attachment.

    Following the advice above I disabled all plugins and re-enabled them one by one. I eventually re-enabled all the plugins I had enabled previously, and it appears to be working fine now.

    Very strange!

    1968Rouleur

    (@1968rouleur)

    Edit: After clearing my cache it appears that the disable/re-enable fix actually did resolve the problem.

    Same problem. Just installed Event Calendar, configured some categories and added an event. When I click on the event I am brought to a 404 Error. See the only event listed on:

    CTOutdoorGuide.com

    I tried the disable/re-enabling of all the plugins but that didn’t do anything. Sorry I don’t have the high level tech skills to provide the troubleshooting data that other posters have.

    Any help would be appreciated. Thanks.

    -Chris

    Thread Starter syrupcore

    (@syrupcore)

Viewing 15 replies - 1 through 15 (of 23 total)
  • The topic ‘404 on single events with pretty permalinks’ is closed to new replies.