723 | 723 | * @param string $output The feed permalink. |
724 | 724 | * @param string $feed The feed type. Possible values include 'rss2', 'atom', |
725 | 725 | * or an empty string for the default feed type. |
726 | 726 | */ |
727 | 727 | return apply_filters( 'feed_link', $output, $feed ); |
728 | 728 | } |
729 | 729 | |
730 | 730 | /** |
731 | 731 | * Retrieves the permalink for the post comments feed. |
732 | 732 | * |
733 | 733 | * @since 2.2.0 |
734 | 734 | * |
735 | 735 | * @param int $post_id Optional. Post ID. Default is the ID of the global `$post`. |
736 | 736 | * @param string $feed Optional. Feed type. Possible values include 'rss2', 'atom'. |
737 | 737 | * Default is the value of get_default_feed(). |
752 | 756 | $unattached = 'attachment' === $post->post_type && 0 === (int) $post->post_parent; |
753 | 757 | |
754 | 758 | if ( get_option( 'permalink_structure' ) ) { |
755 | 759 | if ( 'page' === get_option( 'show_on_front' ) && get_option( 'page_on_front' ) == $post_id ) { |
756 | 760 | $url = _get_page_link( $post_id ); |
757 | 761 | } else { |
758 | 762 | $url = get_permalink( $post_id ); |
759 | 763 | } |
760 | 764 | |
761 | 765 | if ( $unattached ) { |
762 | 766 | $url = home_url( '/feed/' ); |
763 | 767 | if ( get_default_feed() !== $feed ) { |
764 | 768 | $url .= "$feed/"; |
765 | 769 | } |
766 | 770 | $url = add_query_arg( 'attachment_id', $post_id, $url ); |