Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Matt Jaworski

    (@jaworskimatt)

    It looks like the plugin is rewriting all embeds, not just its own embeds in my-calendar-call-template.php

    add_action( 'template_redirect', 'mc_embed_template' );

    I have temporarily patched around it by excluding other post types

    
    global $post;
    if($post instanceof WP_Post && $post->post_type!='mc-events') return;
    

    Full function:

    
    function mc_embed_template() {
    	// Return early if there is no reason to proceed.
    	if ( ! isset( $_GET['embed'] ) ) {
    		return;
    	}
        // Return early if it's not a My Calendar post type
        global $post;
        if($post instanceof WP_Post && $post->post_type!='mc-events') return;
    
    	add_filter( 'show_admin_bar', '__return_false' );
    
    	// Check to see if there is a template in the theme.
    	$template = locate_template( array( 'my-calendar-template.php' ) );
    	if ( ! empty( $template ) ) {
    		require_once $template;
    		exit;
    	} else {
    		// Use plugin's template file.
    		require_once MC_TEMPLATES . 'my-calendar-template.php';
    		exit;
    	}
    }
    
    Plugin Author Joe Dolson

    (@joedolson)

    I haven’t been able to reproduce this, although I can see a problem potential here, since the ’embed’ parameter is really too generic, and could easily catch other cases. But if you could share the specific URL you’re embedding, that would be helpful.

    The change you’ve added is probably working to solve your problem, but would break the embedding feature, so it’s not something I can just drop in.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Activating the plugin breaks WP embeds’ is closed to new replies.