wc_fix_product_attachment_link()
Prevent product attachment links from breaking when using complex rewrite structures.
Хуков нет.
Возвращает
Строку
.
Использование
wc_fix_product_attachment_link( $link, $post_id );
- $link(строка) (обязательный)
- Link.
- $post_id(int) (обязательный)
- Post ID.
Код wc_fix_product_attachment_link() wc fix product attachment link WC 9.5.1
function wc_fix_product_attachment_link( $link, $post_id ) { $parent_type = get_post_type( wp_get_post_parent_id( $post_id ) ); if ( 'product' === $parent_type || 'product_variation' === $parent_type ) { $link = home_url( '/?attachment_id=' . $post_id ); } return $link; }