Merge pull request #16427 from nyordanov/variation-permalink-infinite-loop

Prevent infinite recursion in WC_Post_Data::variation_post_link()
This commit is contained in:
Mike Jolley 2017-08-15 10:59:36 +01:00 committed by GitHub
commit f62d505797
1 changed files with 1 additions and 1 deletions

View File

@ -66,7 +66,7 @@ class WC_Post_Data {
* @return string
*/
public static function variation_post_link( $permalink, $post ) {
if ( isset( $post->ID, $post->post_type ) && 'product_variation' === $post->post_type && ( $variation = wc_get_product( $post->ID ) ) ) {
if ( isset( $post->ID, $post->post_type ) && 'product_variation' === $post->post_type && ( $variation = wc_get_product( $post->ID ) ) && $variation->get_parent_id() ) {
return $variation->get_permalink();
}
return $permalink;