• I’m not sure when the preview_post_link filter became available, but it can be used to resolve the old issue with the Preview Post routing mapped domains to the original and causing the “You do not have permission to view previews” wp_die page. Here it is:

    /*
     * WPMS Domain Mapping doesn't resolve mapped domain for the Preview link
     * Requires WordPress MU Domain Mapping to be active.
     */
    
    function gows_domain_preview_fix( $preview_url ) {
    	/*slice the base url from the preview path*/
    	$crop_vars = substr( $preview_url, strlen( get_option('home') ) );
    	/*get the mapped url from WPMU Domain Mapping function*/
    	$mapped_domain = domain_mapping_siteurl( false );
    	/*concat the two*/
        return $mapped_domain . $crop_vars;
    }
    if ( defined( 'DOMAIN_MAPPING' ) ) {
    	add_filter( 'preview_post_link', 'gows_domain_preview_fix' );
    }

    https://wordpress.org/plugins/wordpress-mu-domain-mapping/

  • The topic ‘Preview Post link fix’ is closed to new replies.