Forum Replies Created

Viewing 1 replies (of 1 total)
  • Hi, same issue here ; On my blog I use the default Menu with sub-menus populated from a private section and a public section. When a public user is on the site a got access to public menus, when a private user is logged in he got access to public+private menus.
    Since 4.4, permalinks are broken on the private side.

    The following function does fix the links, if you call it instead of get_permalinks in “nav-menu.php”. But this is not a definitive solution.

    function get_permalink2( $ID ) {
    		/* $permalink = get_post_permalink($ID); */
    		$permalink=get_the_permalink($ID);
    		if ( get_post_status($ID) === 'private' and $parent_id = wp_get_post_parent_id( $ID ) ) :
    			if ( $parent_id ) :
    				$new_permalink = substr( get_the_permalink( $parent_id ), 0, -1 ); // substr removes last slash
    				return str_replace( site_url(), $new_permalink, $permalink );
    			endif;
    		endif;
    		return $permalink;
    	}

    The issue will have to be fixed in the orignal get_permalink one-day … (link-template.php).

Viewing 1 replies (of 1 total)