Prevent is_page being true. Closes #529.

This commit is contained in:
Mike Jolley 2012-01-25 20:13:54 +00:00
parent 74a2662c59
commit 6b788cdd93
2 changed files with 5 additions and 2 deletions

View File

@ -24,10 +24,13 @@ function woocommerce_mail( $to, $subject, $message, $headers = "Content-Type: te
* WooCommerce page IDs
*
* retrieve page ids - used for myaccount, edit_address, change_password, shop, cart, checkout, pay, view_order, thanks, terms, order_tracking
*
* returns -1 if no page is found
**/
if (!function_exists('woocommerce_get_page_id')) {
function woocommerce_get_page_id( $page ) {
return apply_filters('woocommerce_get_' . $page . '_page_id', get_option('woocommerce_' . $page . '_page_id'));
$page = apply_filters('woocommerce_get_' . $page . '_page_id', get_option('woocommerce_' . $page . '_page_id'));
return ($page) ? $page : -1;
}
}

View File

@ -16,7 +16,7 @@ function woocommerce_redirects() {
global $woocommerce;
// When default permalinks are enabled, redirect shop page to post type archive url
if ( isset($_GET['page_id']) && get_option( 'permalink_structure' )=="" && $_GET['page_id'] == woocommerce_get_page_id('shop') ) :
if ( isset($_GET['page_id']) && $_GET['page_id'] > 0 && get_option( 'permalink_structure' )=="" && $_GET['page_id'] == woocommerce_get_page_id('shop') ) :
wp_safe_redirect( get_post_type_archive_link('product') );
exit;
endif;