| 650 | |
| 651 | /** |
| 652 | * Creates the [privacy-policy-page] shortcode |
| 653 | * |
| 654 | * @since 5.0.0 |
| 655 | * |
| 656 | * @param array $atts Shortcode attributes Link Text, Link Divider. |
| 657 | * |
| 658 | * @uses get_option() |
| 659 | * @uses get_post_status() |
| 660 | * @uses get_page_link() |
| 661 | * |
| 662 | * @return string Link to Privacy Policy page |
| 663 | */ |
| 664 | |
| 665 | function wp_privacy_policy_page_shortcode( $atts ) { |
| 666 | |
| 667 | $atr = shortcode_atts( array( |
| 668 | 'text' => __( 'Privacy Policy' ), |
| 669 | 'divider' => '', |
| 670 | ), $atts ); |
| 671 | |
| 672 | $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); |
| 673 | |
| 674 | if ( ! empty( $privacy_policy_page_id ) && 'publish' === get_post_status( $privacy_policy_page_id ) ) { |
| 675 | return $atr['divider'] . '<a href="' . get_page_link( $privacy_policy_page_id ) . '">' . $atr['text'] . '</a>'; |
| 676 | } |
| 677 | return; |
| 678 | } |
| 679 | add_shortcode( 'privacy-policy-page', 'wp_privacy_policy_page_shortcode' ); |