WordPress.org

Forums

WordPress MU Sitewide Tags Pages
[resolved] Are CPT entries supposed to be copied into the wp_posts table? (6 posts)

  1. Suzanne Ahjira
    Member
    Posted 8 months ago #

    Hi guys,

    I'm trying to get "events" from the All In One Events Calendar ( cpt = ai1ec_event ) into my SWT blog. The SWT site and all child sites in the network use the plugin which generates the ai1ec_event CPT but when an event is posted in a child blog, it's not being copied to the SWT blog's events table. It's being copied to the SWT's wp_posts table and the GUID "looks" wrong. In my latest attempt the GUID is http://16.21 which I'm guessing is the child blog ID and the event ID. Maybe that's an issue and maybe not, but it's not like a normal GUID and it's not in the events table and it causes a white screen with no errors when error reporting is turned on. If I delete the entry directly out of the database, it fixes the white screen so it's not an issue with my function.

    Any thoughts on this?

    This is my function:

    function bart_swt_post_type_filter( $ai1ec_event ) {
    $ai1ec_event['ai1ec_event'] = true;
    return $ai1ec_event;
    }
    add_filter( 'sitewide_tags_allowed_post_types', 'bart_swt_post_type_filter' );

    https://wordpress.org/plugins/wordpress-mu-sitewide-tags/

  2. Suzanne Ahjira
    Member
    Posted 8 months ago #

    Never mind the issue of it being in the wp_posts table. That's not it and I see that's how it's supposed to be.

    However, the GUID is not coming in correctly. I changed the GUID to give it something like you'd expect. That didn't work either. Clearly the content is getting posted to the table, but why it causes the white screen is the issue. There's nothing in my error logs either.

  3. Suzanne Ahjira
    Member
    Posted 8 months ago #

    Okay THIS is what causes the white screen. This is straight out of the codex which will merge CPTs with your main blog entries.

    function bart_my_post_types_to_query( $query ) {
      if ( is_home() && $query->is_main_query() )
        $query->set( 'post_type', array( 'post', 'ai1ec_event' ) );
      return $query;
    }
    add_action( 'pre_get_posts', 'bart_my_post_types_to_query' );

    I realize this might be out of the scope of SWT now but any light someone can shed on this for me would help.

    1. My events ARE being copied into the SWT blog.

    2. They are NOT showing up in my blog feed however because they come in with the correct CPT in the database record -> ai1ec_event, not post. The function above is supposed to handle that but it causes the white screen when a copied event is found in the database. Changing the copied entry to a post_type of post alleviates the entire problem.

    Hopefully that's enough info to get to the bottom of it. Much appreciate to anyone who can help me out with this one. Thanks!

  4. Ron Rennick
    MultiSite Guru
    Plugin Author

    Posted 8 months ago #

    Do you have the event calendar plugin active on the SWT blog?

  5. Suzanne Ahjira
    Member
    Posted 8 months ago #

    Hi Ron - yes. It's active on every blog. Should it be turned off on the SWT blog?

  6. Suzanne Ahjira
    Member
    Posted 8 months ago #

    Okay I turned it off for the SWT blog and left it on for child blogs. Now it works. We can't make events on the parent site, but I think it's better to find a work-around for that than abandon the efficiency of having the child blogs push their events to the parent.

    As always thanks for such great functionality in all your work Ron. I love all your stuff and thanks for the little tip in the right direction here.

Reply

You must log in to post.

About this Plugin

  • WordPress MU Sitewide Tags Pages
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.