at path:ROOT / wp-includes / feed.php
run:R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:52
R W Run
DIR
2026-03-11 16:18:51
R W Run
DIR
2026-03-11 16:18:51
R W Run
23.8 KB
2026-03-11 16:18:51
R W Run
7.8 KB
2026-03-11 16:18:52
R W Run
36.1 KB
2026-03-11 16:18:51
R W Run
11.9 KB
2026-03-11 16:18:52
R W Run
18.94 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:52
R W Run
28.6 KB
2026-03-11 16:18:51
R W Run
316 By
2026-03-11 16:18:51
R W Run
12.9 KB
2026-03-11 16:18:51
R W Run
61.02 KB
2026-03-11 16:18:52
R W Run
15 KB
2026-03-11 16:18:51
R W Run
112.05 KB
2026-03-11 16:18:51
R W Run
12.47 KB
2026-03-11 16:18:51
R W Run
15.07 KB
2026-03-11 16:18:52
R W Run
9.84 KB
2026-03-11 16:18:52
R W Run
13.17 KB
2026-03-11 16:18:52
R W Run
33.83 KB
2026-03-11 16:18:51
R W Run
42.63 KB
2026-03-11 16:18:51
R W Run
55.71 KB
2026-03-11 16:18:52
R W Run
12.53 KB
2026-03-11 16:18:51
R W Run
2.55 KB
2026-03-11 16:18:52
R W Run
28.92 KB
2026-03-11 16:18:52
R W Run
539 By
2026-03-11 16:18:51
R W Run
367 By
2026-03-11 16:18:52
R W Run
42.65 KB
2026-03-11 16:18:51
R W Run
401 By
2026-03-11 16:18:51
R W Run
6.61 KB
2026-03-11 16:18:51
R W Run
664 By
2026-03-11 16:18:52
R W Run
20.63 KB
2026-03-11 16:18:51
R W Run
2.18 KB
2026-03-11 16:18:52
R W Run
453 By
2026-03-11 16:18:52
R W Run
457 By
2026-03-11 16:18:51
R W Run
36.83 KB
2026-03-11 16:18:52
R W Run
2.41 KB
2026-03-11 16:18:52
R W Run
8.28 KB
2026-03-11 16:18:51
R W Run
13.89 KB
2026-03-11 16:18:51
R W Run
11.76 KB
2026-03-11 16:18:51
R W Run
2.65 KB
2026-03-11 16:18:51
R W Run
7.43 KB
2026-03-11 16:18:51
R W Run
17.46 KB
2026-03-11 16:18:51
R W Run
5.14 KB
2026-03-11 16:18:52
R W Run
16.7 KB
2026-03-11 16:18:51
R W Run
8.28 KB
2026-03-11 16:18:52
R W Run
2.92 KB
2026-03-11 16:18:52
R W Run
1.32 KB
2026-03-11 16:18:51
R W Run
4.6 KB
2026-03-11 16:18:52
R W Run
11.62 KB
2026-03-11 16:18:52
R W Run
2.5 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
11.25 KB
2026-03-11 16:18:52
R W Run
5.32 KB
2026-03-11 16:18:51
R W Run
10.99 KB
2026-03-11 16:18:52
R W Run
68.32 KB
2026-03-11 16:18:51
R W Run
6.34 KB
2026-03-11 16:18:51
R W Run
5.49 KB
2026-03-11 16:18:51
R W Run
1.99 KB
2026-03-11 16:18:52
R W Run
7.02 KB
2026-03-11 16:18:51
R W Run
4.91 KB
2026-03-11 16:18:52
R W Run
16.86 KB
2026-03-11 16:18:51
R W Run
24.23 KB
2026-03-11 16:18:51
R W Run
3.97 KB
2026-03-11 16:18:51
R W Run
47.66 KB
2026-03-11 16:18:51
R W Run
9.22 KB
2026-03-11 16:18:51
R W Run
25.51 KB
2026-03-11 16:18:51
R W Run
198.38 KB
2026-03-11 16:18:52
R W Run
56.65 KB
2026-03-11 16:18:51
R W Run
10.46 KB
2026-03-11 16:18:51
R W Run
10.95 KB
2026-03-11 16:18:52
R W Run
29.26 KB
2026-03-11 16:18:51
R W Run
70.91 KB
2026-03-11 16:18:52
R W Run
35.3 KB
2026-03-11 16:18:52
R W Run
16.61 KB
2026-03-11 16:18:52
R W Run
2.57 KB
2026-03-11 16:18:52
R W Run
39.83 KB
2026-03-11 16:18:51
R W Run
70.64 KB
2026-03-11 16:18:51
R W Run
15.56 KB
2026-03-11 16:18:52
R W Run
7.33 KB
2026-03-11 16:18:52
R W Run
253 By
2026-03-11 16:18:51
R W Run
7.96 KB
2026-03-11 16:18:52
R W Run
3.23 KB
2026-03-11 16:18:52
R W Run
969 By
2026-03-11 16:18:52
R W Run
16.28 KB
2026-03-11 16:18:51
R W Run
7.22 KB
2026-03-11 16:18:51
R W Run
12.95 KB
2026-03-11 16:18:51
R W Run
6.53 KB
2026-03-11 16:18:51
R W Run
3.42 KB
2026-03-11 16:18:52
R W Run
5.84 KB
2026-03-11 16:18:51
R W Run
1.97 KB
2026-03-11 16:18:51
R W Run
4.3 KB
2026-03-11 16:18:52
R W Run
2.91 KB
2026-03-11 16:18:51
R W Run
16.46 KB
2026-03-11 16:18:52
R W Run
40.6 KB
2026-03-11 16:18:51
R W Run
20.22 KB
2026-03-11 16:18:51
R W Run
36.11 KB
2026-03-11 16:18:52
R W Run
17.01 KB
2026-03-11 16:18:51
R W Run
7.27 KB
2026-03-11 16:18:52
R W Run
6.62 KB
2026-03-11 16:18:52
R W Run
16.49 KB
2026-03-11 16:18:52
R W Run
1.79 KB
2026-03-11 16:18:52
R W Run
29.82 KB
2026-03-11 16:18:51
R W Run
6.67 KB
2026-03-11 16:18:52
R W Run
8.98 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:51
R W Run
12.01 KB
2026-03-11 16:18:51
R W Run
17.11 KB
2026-03-11 16:18:51
R W Run
6.74 KB
2026-03-11 16:18:52
R W Run
30.93 KB
2026-03-11 16:18:51
R W Run
4.99 KB
2026-03-11 16:18:51
R W Run
4.25 KB
2026-03-11 16:18:51
R W Run
24.72 KB
2026-03-11 16:18:51
R W Run
29.96 KB
2026-03-11 16:18:52
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
160 KB
2026-03-11 16:18:51
R W Run
6.72 KB
2026-03-11 16:18:52
R W Run
10.92 KB
2026-03-11 16:18:51
R W Run
4.77 KB
2026-03-11 16:18:51
R W Run
3.38 KB
2026-03-11 16:18:51
R W Run
11.18 KB
2026-03-11 16:18:51
R W Run
62.19 KB
2026-03-11 16:18:51
R W Run
2.46 KB
2026-03-11 16:18:51
R W Run
9.17 KB
2026-03-11 16:18:51
R W Run
32.15 KB
2026-03-11 16:18:51
R W Run
34.05 KB
2026-03-11 16:18:52
R W Run
7.15 KB
2026-03-11 16:18:51
R W Run
3.47 KB
2026-03-11 16:18:52
R W Run
1.87 KB
2026-03-11 16:18:52
R W Run
30.91 KB
2026-03-11 16:18:51
R W Run
7.29 KB
2026-03-11 16:18:52
R W Run
7.35 KB
2026-03-11 16:18:51
R W Run
12.54 KB
2026-03-11 16:18:51
R W Run
19.12 KB
2026-03-11 16:18:51
R W Run
18.12 KB
2026-03-11 16:18:52
R W Run
39.99 KB
2026-03-11 16:18:52
R W Run
5.17 KB
2026-03-11 16:18:52
R W Run
979 By
2026-03-11 16:18:51
R W Run
18.44 KB
2026-03-11 16:18:52
R W Run
10.24 KB
2026-03-11 16:18:51
R W Run
1.77 KB
2026-03-11 16:18:52
R W Run
34.9 KB
2026-03-11 16:18:51
R W Run
7.19 KB
2026-03-11 16:18:52
R W Run
160.5 KB
2026-03-11 16:18:51
R W Run
64.27 KB
2026-03-11 16:18:51
R W Run
27.95 KB
2026-03-11 16:18:51
R W Run
4.69 KB
2026-03-11 16:18:51
R W Run
2.94 KB
2026-03-11 16:18:51
R W Run
43.13 KB
2026-03-11 16:18:52
R W Run
2.25 KB
2026-03-11 16:18:52
R W Run
22.5 KB
2026-03-11 16:18:51
R W Run
13.01 KB
2026-03-11 16:18:52
R W Run
3.27 KB
2026-03-11 16:18:51
R W Run
18 KB
2026-03-11 16:18:51
R W Run
210.4 KB
2026-03-11 16:18:52
R W Run
25.86 KB
2026-03-11 16:18:52
R W Run
115.85 KB
2026-03-11 16:18:51
R W Run
373 By
2026-03-11 16:18:52
R W Run
343 By
2026-03-11 16:18:52
R W Run
338 By
2026-03-11 16:18:51
R W Run
100.73 KB
2026-03-11 16:18:52
R W Run
130.93 KB
2026-03-11 16:18:51
R W Run
19.1 KB
2026-03-11 16:18:51
R W Run
17.41 KB
2026-03-11 16:18:52
R W Run
41.98 KB
2026-03-11 16:18:52
R W Run
400 By
2026-03-11 16:18:52
R W Run
11.1 KB
2026-03-11 16:18:52
R W Run
37.02 KB
2026-03-11 16:18:51
R W Run
2.24 KB
2026-03-11 16:18:51
R W Run
188.13 KB
2026-03-11 16:18:51
R W Run
338 By
2026-03-11 16:18:51
R W Run
38 KB
2026-03-11 16:18:51
R W Run
4.02 KB
2026-03-11 16:18:52
R W Run
5.38 KB
2026-03-11 16:18:51
R W Run
3.05 KB
2026-03-11 16:18:52
R W Run
2.61 KB
2026-03-11 16:18:51
R W Run
1.16 KB
2026-03-11 16:18:52
R W Run
4.04 KB
2026-03-11 16:18:51
R W Run
3.71 KB
2026-03-11 16:18:51
R W Run
24.6 KB
2026-03-11 16:18:51
R W Run
9.56 KB
2026-03-11 16:18:51
R W Run
346.43 KB
2026-03-11 16:18:52
R W Run
281.84 KB
2026-03-11 16:18:52
R W Run
14.95 KB
2026-03-11 16:18:51
R W Run
8.44 KB
2026-03-11 16:18:52
R W Run
168.95 KB
2026-03-11 16:18:52
R W Run
20.71 KB
2026-03-11 16:18:52
R W Run
25.27 KB
2026-03-11 16:18:51
R W Run
5.72 KB
2026-03-11 16:18:51
R W Run
4.63 KB
2026-03-11 16:18:52
R W Run
81.73 KB
2026-03-11 16:18:51
R W Run
67.18 KB
2026-03-11 16:18:51
R W Run
156.36 KB
2026-03-11 16:18:52
R W Run
55.19 KB
2026-03-11 16:18:51
R W Run
162 By
2026-03-11 16:18:51
R W Run
61.72 KB
2026-03-11 16:18:51
R W Run
216.06 KB
2026-03-11 16:18:52
R W Run
65.09 KB
2026-03-11 16:18:51
R W Run
25.24 KB
2026-03-11 16:18:52
R W Run
4.81 KB
2026-03-11 16:18:51
R W Run
6.48 KB
2026-03-11 16:18:52
R W Run
21.25 KB
2026-03-11 16:18:51
R W Run
2.79 KB
2026-03-11 16:18:52
R W Run
89.69 KB
2026-03-11 16:18:52
R W Run
19.42 KB
2026-03-11 16:18:52
R W Run
3.69 KB
2026-03-11 16:18:52
R W Run
4.11 KB
2026-03-11 16:18:51
R W Run
40.74 KB
2026-03-11 16:18:51
R W Run
25.38 KB
2026-03-11 16:18:51
R W Run
43.31 KB
2026-03-11 16:18:52
R W Run
102.57 KB
2026-03-11 16:18:52
R W Run
6.18 KB
2026-03-11 16:18:51
R W Run
124.47 KB
2026-03-11 16:18:52
R W Run
35.65 KB
2026-03-11 16:18:52
R W Run
6.94 KB
2026-03-11 16:18:52
R W Run
67.04 KB
2026-03-11 16:18:52
R W Run
10.62 KB
2026-03-11 16:18:51
R W Run
289.35 KB
2026-03-11 16:18:52
R W Run
36.23 KB
2026-03-11 16:18:51
R W Run
200 By
2026-03-11 16:18:52
R W Run
200 By
2026-03-11 16:18:52
R W Run
98.29 KB
2026-03-11 16:18:52
R W Run
30.02 KB
2026-03-11 16:18:52
R W Run
19.03 KB
2026-03-11 16:18:52
R W Run
5.06 KB
2026-03-11 16:18:52
R W Run
255 By
2026-03-11 16:18:51
R W Run
22.66 KB
2026-03-11 16:18:52
R W Run
154.63 KB
2026-03-11 16:18:51
R W Run
9.68 KB
2026-03-11 16:18:51
R W Run
258 By
2026-03-11 16:18:51
R W Run
23.49 KB
2026-03-11 16:18:51
R W Run
3.16 KB
2026-03-11 16:18:51
R W Run
8.4 KB
2026-03-11 16:18:52
R W Run
441 By
2026-03-11 16:18:51
R W Run
7.39 KB
2026-03-11 16:18:51
R W Run
173 KB
2026-03-11 16:18:52
R W Run
544 By
2026-03-11 16:18:52
R W Run
4.17 KB
2026-03-11 16:18:51
R W Run
35.97 KB
2026-03-11 16:18:52
R W Run
1.69 KB
2026-03-11 16:18:51
R W Run
2.84 KB
2026-03-11 16:18:52
R W Run
6.09 KB
2026-03-11 16:18:51
R W Run
8.71 KB
2026-03-11 16:18:51
R W Run
131.84 KB
2026-03-11 16:18:51
R W Run
37.45 KB
2026-03-11 16:18:51
R W Run
173.89 KB
2026-03-11 16:18:51
R W Run
7.09 KB
2026-03-11 16:18:51
R W Run
6.41 KB
2026-03-11 16:18:51
R W Run
1.08 KB
2026-03-11 16:18:51
R W Run
69.46 KB
2026-03-11 16:18:52
R W Run
445 By
2026-03-11 16:18:51
R W Run
799 By
2026-03-11 16:18:52
R W Run
error_log
📄feed.php
1<?php
2/**
3 * WordPress Feed API
4 *
5 * Many of the functions used in here belong in The Loop, or The Loop for the
6 * Feeds.
7 *
8 * @package WordPress
9 * @subpackage Feed
10 * @since 2.1.0
11 */
12
13/**
14 * Retrieves RSS container for the bloginfo function.
15 *
16 * You can retrieve anything that you can using the get_bloginfo() function.
17 * Everything will be stripped of tags and characters converted, when the values
18 * are retrieved for use in the feeds.
19 *
20 * @since 1.5.1
21 *
22 * @see get_bloginfo() For the list of possible values to display.
23 *
24 * @param string $show See get_bloginfo() for possible values.
25 * @return string
26 */
27function get_bloginfo_rss( $show = '' ) {
28 $info = strip_tags( get_bloginfo( $show ) );
29 /**
30 * Filters the bloginfo for use in RSS feeds.
31 *
32 * @since 2.2.0
33 *
34 * @see convert_chars()
35 * @see get_bloginfo()
36 *
37 * @param string $info Converted string value of the blog information.
38 * @param string $show The type of blog information to retrieve.
39 */
40 return apply_filters( 'get_bloginfo_rss', convert_chars( $info ), $show );
41}
42
43/**
44 * Displays RSS container for the bloginfo function.
45 *
46 * You can retrieve anything that you can using the get_bloginfo() function.
47 * Everything will be stripped of tags and characters converted, when the values
48 * are retrieved for use in the feeds.
49 *
50 * @since 0.71
51 *
52 * @see get_bloginfo() For the list of possible values to display.
53 *
54 * @param string $show See get_bloginfo() for possible values.
55 */
56function bloginfo_rss( $show = '' ) {
57 /**
58 * Filters the bloginfo for display in RSS feeds.
59 *
60 * @since 2.1.0
61 *
62 * @see get_bloginfo()
63 *
64 * @param string $rss_container RSS container for the blog information.
65 * @param string $show The type of blog information to retrieve.
66 */
67 echo apply_filters( 'bloginfo_rss', get_bloginfo_rss( $show ), $show );
68}
69
70/**
71 * Retrieves the default feed.
72 *
73 * The default feed is 'rss2', unless a plugin changes it through the
74 * {@see 'default_feed'} filter.
75 *
76 * @since 2.5.0
77 *
78 * @return string Default feed, or for example 'rss2', 'atom', etc.
79 */
80function get_default_feed() {
81 /**
82 * Filters the default feed type.
83 *
84 * @since 2.5.0
85 *
86 * @param string $feed_type Type of default feed. Possible values include 'rss2', 'atom'.
87 * Default 'rss2'.
88 */
89 $default_feed = apply_filters( 'default_feed', 'rss2' );
90
91 return ( 'rss' === $default_feed ) ? 'rss2' : $default_feed;
92}
93
94/**
95 * Retrieves the blog title for the feed title.
96 *
97 * @since 2.2.0
98 * @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`.
99 *
100 * @param string $deprecated Unused.
101 * @return string The document title.
102 */
103function get_wp_title_rss( $deprecated = '&#8211;' ) {
104 if ( '&#8211;' !== $deprecated ) {
105 /* translators: %s: 'document_title_separator' filter name. */
106 _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) );
107 }
108
109 /**
110 * Filters the blog title for use as the feed title.
111 *
112 * @since 2.2.0
113 * @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`.
114 *
115 * @param string $title The current blog title.
116 * @param string $deprecated Unused.
117 */
118 return apply_filters( 'get_wp_title_rss', wp_get_document_title(), $deprecated );
119}
120
121/**
122 * Displays the blog title for display of the feed title.
123 *
124 * @since 2.2.0
125 * @since 4.4.0 The optional `$sep` parameter was deprecated and renamed to `$deprecated`.
126 *
127 * @param string $deprecated Unused.
128 */
129function wp_title_rss( $deprecated = '&#8211;' ) {
130 if ( '&#8211;' !== $deprecated ) {
131 /* translators: %s: 'document_title_separator' filter name. */
132 _deprecated_argument( __FUNCTION__, '4.4.0', sprintf( __( 'Use the %s filter instead.' ), '<code>document_title_separator</code>' ) );
133 }
134
135 /**
136 * Filters the blog title for display of the feed title.
137 *
138 * @since 2.2.0
139 * @since 4.4.0 The `$sep` parameter was deprecated and renamed to `$deprecated`.
140 *
141 * @see get_wp_title_rss()
142 *
143 * @param string $wp_title_rss The current blog title.
144 * @param string $deprecated Unused.
145 */
146 echo apply_filters( 'wp_title_rss', get_wp_title_rss(), $deprecated );
147}
148
149/**
150 * Retrieves the current post title for the feed.
151 *
152 * @since 2.0.0
153 * @since 6.6.0 Added the `$post` parameter.
154 *
155 * @param int|WP_Post $post Optional. Post ID or WP_Post object. Default is global $post.
156 * @return string Current post title.
157 */
158function get_the_title_rss( $post = 0 ) {
159 $title = get_the_title( $post );
160
161 /**
162 * Filters the post title for use in a feed.
163 *
164 * @since 1.2.0
165 *
166 * @param string $title The current post title.
167 */
168 return apply_filters( 'the_title_rss', $title );
169}
170
171/**
172 * Displays the post title in the feed.
173 *
174 * @since 0.71
175 */
176function the_title_rss() {
177 echo get_the_title_rss();
178}
179
180/**
181 * Retrieves the post content for feeds.
182 *
183 * @since 2.9.0
184 *
185 * @see get_the_content()
186 *
187 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf
188 * @return string The filtered content.
189 */
190function get_the_content_feed( $feed_type = null ) {
191 if ( ! $feed_type ) {
192 $feed_type = get_default_feed();
193 }
194
195 /** This filter is documented in wp-includes/post-template.php */
196 $content = apply_filters( 'the_content', get_the_content() );
197 $content = str_replace( ']]>', ']]&gt;', $content );
198
199 /**
200 * Filters the post content for use in feeds.
201 *
202 * @since 2.9.0
203 *
204 * @param string $content The current post content.
205 * @param string $feed_type Type of feed. Possible values include 'rss2', 'atom'.
206 * Default 'rss2'.
207 */
208 return apply_filters( 'the_content_feed', $content, $feed_type );
209}
210
211/**
212 * Displays the post content for feeds.
213 *
214 * @since 2.9.0
215 *
216 * @param string $feed_type The type of feed. rss2 | atom | rss | rdf
217 */
218function the_content_feed( $feed_type = null ) {
219 echo get_the_content_feed( $feed_type );
220}
221
222/**
223 * Displays the post excerpt for the feed.
224 *
225 * @since 0.71
226 */
227function the_excerpt_rss() {
228 $output = get_the_excerpt();
229 /**
230 * Filters the post excerpt for a feed.
231 *
232 * @since 1.2.0
233 *
234 * @param string $output The current post excerpt.
235 */
236 echo apply_filters( 'the_excerpt_rss', $output );
237}
238
239/**
240 * Displays the permalink to the post for use in feeds.
241 *
242 * @since 2.3.0
243 */
244function the_permalink_rss() {
245 /**
246 * Filters the permalink to the post for use in feeds.
247 *
248 * @since 2.3.0
249 *
250 * @param string $post_permalink The current post permalink.
251 */
252 echo esc_url( apply_filters( 'the_permalink_rss', get_permalink() ) );
253}
254
255/**
256 * Outputs the link to the comments for the current post in an XML safe way.
257 *
258 * @since 3.0.0
259 */
260function comments_link_feed() {
261 /**
262 * Filters the comments permalink for the current post.
263 *
264 * @since 3.6.0
265 *
266 * @param string $comment_permalink The current comment permalink with
267 * '#comments' appended.
268 */
269 echo esc_url( apply_filters( 'comments_link_feed', get_comments_link() ) );
270}
271
272/**
273 * Displays the feed GUID for the current comment.
274 *
275 * @since 2.5.0
276 *
277 * @param int|WP_Comment $comment_id Optional comment object or ID. Defaults to global comment object.
278 */
279function comment_guid( $comment_id = null ) {
280 echo esc_url( get_comment_guid( $comment_id ) );
281}
282
283/**
284 * Retrieves the feed GUID for the current comment.
285 *
286 * @since 2.5.0
287 *
288 * @param int|WP_Comment $comment_id Optional comment object or ID. Defaults to global comment object.
289 * @return string|false GUID for comment on success, false on failure.
290 */
291function get_comment_guid( $comment_id = null ) {
292 $comment = get_comment( $comment_id );
293
294 if ( ! is_object( $comment ) ) {
295 return false;
296 }
297
298 return get_the_guid( $comment->comment_post_ID ) . '#comment-' . $comment->comment_ID;
299}
300
301/**
302 * Displays the link to the comments.
303 *
304 * @since 1.5.0
305 * @since 4.4.0 Introduced the `$comment` argument.
306 *
307 * @param int|WP_Comment $comment Optional. Comment object or ID. Defaults to global comment object.
308 */
309function comment_link( $comment = null ) {
310 /**
311 * Filters the current comment's permalink.
312 *
313 * @since 3.6.0
314 *
315 * @see get_comment_link()
316 *
317 * @param string $comment_permalink The current comment permalink.
318 */
319 echo esc_url( apply_filters( 'comment_link', get_comment_link( $comment ) ) );
320}
321
322/**
323 * Retrieves the current comment author for use in the feeds.
324 *
325 * @since 2.0.0
326 *
327 * @return string Comment Author.
328 */
329function get_comment_author_rss() {
330 /**
331 * Filters the current comment author for use in a feed.
332 *
333 * @since 1.5.0
334 *
335 * @see get_comment_author()
336 *
337 * @param string $comment_author The current comment author.
338 */
339 return apply_filters( 'comment_author_rss', get_comment_author() );
340}
341
342/**
343 * Displays the current comment author in the feed.
344 *
345 * @since 1.0.0
346 */
347function comment_author_rss() {
348 echo get_comment_author_rss();
349}
350
351/**
352 * Displays the current comment content for use in the feeds.
353 *
354 * @since 1.0.0
355 */
356function comment_text_rss() {
357 $comment_text = get_comment_text();
358 /**
359 * Filters the current comment content for use in a feed.
360 *
361 * @since 1.5.0
362 *
363 * @param string $comment_text The content of the current comment.
364 */
365 $comment_text = apply_filters( 'comment_text_rss', $comment_text );
366 echo $comment_text;
367}
368
369/**
370 * Retrieves all of the post categories, formatted for use in feeds.
371 *
372 * All of the categories for the current post in the feed loop, will be
373 * retrieved and have feed markup added, so that they can easily be added to the
374 * RSS2, Atom, or RSS1 and RSS0.91 RDF feeds.
375 *
376 * @since 2.1.0
377 *
378 * @param string $type Optional, default is the type returned by get_default_feed().
379 * @return string All of the post categories for displaying in the feed.
380 */
381function get_the_category_rss( $type = null ) {
382 if ( empty( $type ) ) {
383 $type = get_default_feed();
384 }
385 $categories = get_the_category();
386 $tags = get_the_tags();
387 $the_list = '';
388 $cat_names = array();
389
390 $filter = 'rss';
391 if ( 'atom' === $type ) {
392 $filter = 'raw';
393 }
394
395 if ( ! empty( $categories ) ) {
396 foreach ( (array) $categories as $category ) {
397 $cat_names[] = sanitize_term_field( 'name', $category->name, $category->term_id, 'category', $filter );
398 }
399 }
400
401 if ( ! empty( $tags ) ) {
402 foreach ( (array) $tags as $tag ) {
403 $cat_names[] = sanitize_term_field( 'name', $tag->name, $tag->term_id, 'post_tag', $filter );
404 }
405 }
406
407 $cat_names = array_unique( $cat_names );
408
409 foreach ( $cat_names as $cat_name ) {
410 if ( 'rdf' === $type ) {
411 $the_list .= "\t\t<dc:subject><![CDATA[$cat_name]]></dc:subject>\n";
412 } elseif ( 'atom' === $type ) {
413 $the_list .= sprintf( '<category scheme="%1$s" term="%2$s" />', esc_attr( get_bloginfo_rss( 'url' ) ), esc_attr( $cat_name ) );
414 } else {
415 $the_list .= "\t\t<category><![CDATA[" . html_entity_decode( $cat_name, ENT_COMPAT, get_option( 'blog_charset' ) ) . "]]></category>\n";
416 }
417 }
418
419 /**
420 * Filters all of the post categories for display in a feed.
421 *
422 * @since 1.2.0
423 *
424 * @param string $the_list All of the RSS post categories.
425 * @param string $type Type of feed. Possible values include 'rss2', 'atom'.
426 * Default 'rss2'.
427 */
428 return apply_filters( 'the_category_rss', $the_list, $type );
429}
430
431/**
432 * Displays the post categories in the feed.
433 *
434 * @since 0.71
435 *
436 * @see get_the_category_rss() For better explanation.
437 *
438 * @param string $type Optional, default is the type returned by get_default_feed().
439 */
440function the_category_rss( $type = null ) {
441 echo get_the_category_rss( $type );
442}
443
444/**
445 * Displays the HTML type based on the blog setting.
446 *
447 * The two possible values are either 'xhtml' or 'html'.
448 *
449 * @since 2.2.0
450 */
451function html_type_rss() {
452 $type = get_bloginfo( 'html_type' );
453 if ( str_contains( $type, 'xhtml' ) ) {
454 $type = 'xhtml';
455 } else {
456 $type = 'html';
457 }
458 echo $type;
459}
460
461/**
462 * Displays the rss enclosure for the current post.
463 *
464 * Uses the global $post to check whether the post requires a password and if
465 * the user has the password for the post. If not then it will return before
466 * displaying.
467 *
468 * Also uses the function get_post_custom() to get the post's 'enclosure'
469 * metadata field and parses the value to display the enclosure(s). The
470 * enclosure(s) consist of enclosure HTML tag(s) with a URI and other
471 * attributes.
472 *
473 * @since 1.5.0
474 */
475function rss_enclosure() {
476 if ( post_password_required() ) {
477 return;
478 }
479
480 foreach ( (array) get_post_custom() as $key => $val ) {
481 if ( 'enclosure' === $key ) {
482 foreach ( (array) $val as $enc ) {
483 $enclosure = explode( "\n", $enc );
484
485 if ( count( $enclosure ) < 3 ) {
486 continue;
487 }
488
489 // Only get the first element, e.g. 'audio/mpeg' from 'audio/mpeg mpga mp2 mp3'.
490 $t = preg_split( '/[ \t]/', trim( $enclosure[2] ) );
491 $type = $t[0];
492
493 /**
494 * Filters the RSS enclosure HTML link tag for the current post.
495 *
496 * @since 2.2.0
497 *
498 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
499 */
500 echo apply_filters( 'rss_enclosure', '<enclosure url="' . esc_url( trim( $enclosure[0] ) ) . '" length="' . absint( trim( $enclosure[1] ) ) . '" type="' . esc_attr( $type ) . '" />' . "\n" );
501 }
502 }
503 }
504}
505
506/**
507 * Displays the atom enclosure for the current post.
508 *
509 * Uses the global $post to check whether the post requires a password and if
510 * the user has the password for the post. If not then it will return before
511 * displaying.
512 *
513 * Also uses the function get_post_custom() to get the post's 'enclosure'
514 * metadata field and parses the value to display the enclosure(s). The
515 * enclosure(s) consist of link HTML tag(s) with a URI and other attributes.
516 *
517 * @since 2.2.0
518 */
519function atom_enclosure() {
520 if ( post_password_required() ) {
521 return;
522 }
523
524 foreach ( (array) get_post_custom() as $key => $val ) {
525 if ( 'enclosure' === $key ) {
526 foreach ( (array) $val as $enc ) {
527 $enclosure = explode( "\n", $enc );
528
529 $url = '';
530 $type = '';
531 $length = 0;
532
533 $mimes = get_allowed_mime_types();
534
535 // Parse URL.
536 if ( isset( $enclosure[0] ) && is_string( $enclosure[0] ) ) {
537 $url = trim( $enclosure[0] );
538 }
539
540 // Parse length and type.
541 for ( $i = 1; $i <= 2; $i++ ) {
542 if ( isset( $enclosure[ $i ] ) ) {
543 if ( is_numeric( $enclosure[ $i ] ) ) {
544 $length = trim( $enclosure[ $i ] );
545 } elseif ( in_array( $enclosure[ $i ], $mimes, true ) ) {
546 $type = trim( $enclosure[ $i ] );
547 }
548 }
549 }
550
551 $html_link_tag = sprintf(
552 "<link href=\"%s\" rel=\"enclosure\" length=\"%d\" type=\"%s\" />\n",
553 esc_url( $url ),
554 esc_attr( $length ),
555 esc_attr( $type )
556 );
557
558 /**
559 * Filters the atom enclosure HTML link tag for the current post.
560 *
561 * @since 2.2.0
562 *
563 * @param string $html_link_tag The HTML link tag with a URI and other attributes.
564 */
565 echo apply_filters( 'atom_enclosure', $html_link_tag );
566 }
567 }
568 }
569}
570
571/**
572 * Determines the type of a string of data with the data formatted.
573 *
574 * Tell whether the type is text, HTML, or XHTML, per RFC 4287 section 3.1.
575 *
576 * In the case of WordPress, text is defined as containing no markup,
577 * XHTML is defined as "well formed", and HTML as tag soup (i.e., the rest).
578 *
579 * Container div tags are added to XHTML values, per section 3.1.1.3.
580 *
581 * @link http://www.atomenabled.org/developers/syndication/atom-format-spec.php#rfc.section.3.1
582 *
583 * @since 2.5.0
584 *
585 * @param string $data Input string.
586 * @return array array(type, value)
587 */
588function prep_atom_text_construct( $data ) {
589 if ( ! str_contains( $data, '<' ) && ! str_contains( $data, '&' ) ) {
590 return array( 'text', $data );
591 }
592
593 if ( ! function_exists( 'xml_parser_create' ) ) {
594 wp_trigger_error( '', __( "PHP's XML extension is not available. Please contact your hosting provider to enable PHP's XML extension." ) );
595
596 return array( 'html', "<![CDATA[$data]]>" );
597 }
598
599 $parser = xml_parser_create();
600 xml_parse( $parser, '<div>' . $data . '</div>', true );
601 $code = xml_get_error_code( $parser );
602
603 if ( PHP_VERSION_ID < 80000 ) { // xml_parser_free() has no effect as of PHP 8.0.
604 xml_parser_free( $parser );
605 }
606
607 unset( $parser );
608
609 if ( ! $code ) {
610 if ( ! str_contains( $data, '<' ) ) {
611 return array( 'text', $data );
612 } else {
613 $data = "<div xmlns='http://www.w3.org/1999/xhtml'>$data</div>";
614 return array( 'xhtml', $data );
615 }
616 }
617
618 if ( ! str_contains( $data, ']]>' ) ) {
619 return array( 'html', "<![CDATA[$data]]>" );
620 } else {
621 return array( 'html', htmlspecialchars( $data ) );
622 }
623}
624
625/**
626 * Displays Site Icon in atom feeds.
627 *
628 * @since 4.3.0
629 *
630 * @see get_site_icon_url()
631 */
632function atom_site_icon() {
633 $url = get_site_icon_url( 32 );
634 if ( $url ) {
635 echo '<icon>' . convert_chars( $url ) . "</icon>\n";
636 }
637}
638
639/**
640 * Displays Site Icon in RSS2.
641 *
642 * @since 4.3.0
643 */
644function rss2_site_icon() {
645 $rss_title = get_wp_title_rss();
646 if ( empty( $rss_title ) ) {
647 $rss_title = get_bloginfo_rss( 'name' );
648 }
649
650 $url = get_site_icon_url( 32 );
651 if ( $url ) {
652 echo '
653<image>
654 <url>' . convert_chars( $url ) . '</url>
655 <title>' . $rss_title . '</title>
656 <link>' . get_bloginfo_rss( 'url' ) . '</link>
657 <width>32</width>
658 <height>32</height>
659</image> ' . "\n";
660 }
661}
662
663/**
664 * Returns the link for the currently displayed feed.
665 *
666 * @since 5.3.0
667 *
668 * @return string Correct link for the atom:self element.
669 */
670function get_self_link() {
671 $parsed = parse_url( home_url() );
672
673 $domain = $parsed['host'];
674 if ( isset( $parsed['port'] ) ) {
675 $domain .= ':' . $parsed['port'];
676 }
677
678 return set_url_scheme( 'http://' . $domain . wp_unslash( $_SERVER['REQUEST_URI'] ) );
679}
680
681/**
682 * Displays the link for the currently displayed feed in a XSS safe way.
683 *
684 * Generate a correct link for the atom:self element.
685 *
686 * @since 2.5.0
687 */
688function self_link() {
689 /**
690 * Filters the current feed URL.
691 *
692 * @since 3.6.0
693 *
694 * @see set_url_scheme()
695 * @see wp_unslash()
696 *
697 * @param string $feed_link The link for the feed with set URL scheme.
698 */
699 echo esc_url( apply_filters( 'self_link', get_self_link() ) );
700}
701
702/**
703 * Gets the UTC time of the most recently modified post from WP_Query.
704 *
705 * If viewing a comment feed, the time of the most recently modified
706 * comment will be returned.
707 *
708 * @since 5.2.0
709 *
710 * @global WP_Query $wp_query WordPress Query object.
711 *
712 * @param string $format Date format string to return the time in.
713 * @return string|false The time in requested format, or false on failure.
714 */
715function get_feed_build_date( $format ) {
716 global $wp_query;
717
718 $datetime = false;
719 $max_modified_time = false;
720 $utc = new DateTimeZone( 'UTC' );
721
722 if ( ! empty( $wp_query ) && $wp_query->have_posts() ) {
723 // Extract the post modified times from the posts.
724 $modified_times = wp_list_pluck( $wp_query->posts, 'post_modified_gmt' );
725
726 // If this is a comment feed, check those objects too.
727 if ( $wp_query->is_comment_feed() && $wp_query->comment_count ) {
728 // Extract the comment modified times from the comments.
729 $comment_times = wp_list_pluck( $wp_query->comments, 'comment_date_gmt' );
730
731 // Add the comment times to the post times for comparison.
732 $modified_times = array_merge( $modified_times, $comment_times );
733 }
734
735 // Determine the maximum modified time.
736 $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', max( $modified_times ), $utc );
737 }
738
739 if ( false === $datetime ) {
740 // Fall back to last time any post was modified or published.
741 $datetime = date_create_immutable_from_format( 'Y-m-d H:i:s', get_lastpostmodified( 'GMT' ), $utc );
742 }
743
744 if ( false !== $datetime ) {
745 $max_modified_time = $datetime->format( $format );
746 }
747
748 /**
749 * Filters the date the last post or comment in the query was modified.
750 *
751 * @since 5.2.0
752 *
753 * @param string|false $max_modified_time Date the last post or comment was modified in the query, in UTC.
754 * False on failure.
755 * @param string $format The date format requested in get_feed_build_date().
756 */
757 return apply_filters( 'get_feed_build_date', $max_modified_time, $format );
758}
759
760/**
761 * Returns the content type for specified feed type.
762 *
763 * @since 2.8.0
764 *
765 * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'.
766 * @return string Content type for specified feed type.
767 */
768function feed_content_type( $type = '' ) {
769 if ( empty( $type ) ) {
770 $type = get_default_feed();
771 }
772
773 $types = array(
774 'rss' => 'application/rss+xml',
775 'rss2' => 'application/rss+xml',
776 'rss-http' => 'text/xml',
777 'atom' => 'application/atom+xml',
778 'rdf' => 'application/rdf+xml',
779 );
780
781 $content_type = ( ! empty( $types[ $type ] ) ) ? $types[ $type ] : 'application/octet-stream';
782
783 /**
784 * Filters the content type for a specific feed type.
785 *
786 * @since 2.8.0
787 *
788 * @param string $content_type Content type indicating the type of data that a feed contains.
789 * @param string $type Type of feed. Possible values include 'rss', rss2', 'atom', and 'rdf'.
790 */
791 return apply_filters( 'feed_content_type', $content_type, $type );
792}
793
794/**
795 * Builds SimplePie object based on RSS or Atom feed from URL.
796 *
797 * @since 2.8.0
798 *
799 * @param string|string[] $url URL of feed to retrieve. If an array of URLs, the feeds are merged
800 * using SimplePie's multifeed feature.
801 * See also {@link http://simplepie.org/wiki/faq/typical_multifeed_gotchas}
802 * @return SimplePie\SimplePie|WP_Error SimplePie object on success or WP_Error object on failure.
803 */
804function fetch_feed( $url ) {
805 if ( ! class_exists( 'SimplePie\SimplePie', false ) ) {
806 require_once ABSPATH . WPINC . '/class-simplepie.php';
807 }
808
809 require_once ABSPATH . WPINC . '/class-wp-feed-cache-transient.php';
810 require_once ABSPATH . WPINC . '/class-wp-simplepie-file.php';
811 require_once ABSPATH . WPINC . '/class-wp-simplepie-sanitize-kses.php';
812
813 $feed = new SimplePie\SimplePie();
814
815 $feed->get_registry()->register( SimplePie\Sanitize::class, 'WP_SimplePie_Sanitize_KSES', true );
816
817 /*
818 * We must manually overwrite $feed->sanitize because SimplePie's constructor
819 * sets it before we have a chance to set the sanitization class.
820 */
821 $feed->sanitize = new WP_SimplePie_Sanitize_KSES();
822
823 // Register the cache handler using the recommended method for SimplePie 1.3 or later.
824 if ( method_exists( 'SimplePie_Cache', 'register' ) ) {
825 SimplePie_Cache::register( 'wp_transient', 'WP_Feed_Cache_Transient' );
826 $feed->set_cache_location( 'wp_transient' );
827 } else {
828 // Back-compat for SimplePie 1.2.x.
829 require_once ABSPATH . WPINC . '/class-wp-feed-cache.php';
830 $feed->set_cache_class( 'WP_Feed_Cache' );
831 }
832
833 $feed->get_registry()->register( SimplePie\File::class, 'WP_SimplePie_File', true );
834
835 /** This filter is documented in wp-includes/class-wp-feed-cache-transient.php */
836 $feed->set_cache_duration( apply_filters( 'wp_feed_cache_transient_lifetime', 12 * HOUR_IN_SECONDS, $url ) );
837
838 /**
839 * Fires just before processing the SimplePie feed object.
840 *
841 * @since 3.0.0
842 *
843 * @param SimplePie\SimplePie $feed SimplePie feed object (passed by reference).
844 * @param string|string[] $url URL of feed or array of URLs of feeds to retrieve.
845 */
846 do_action_ref_array( 'wp_feed_options', array( &$feed, $url ) );
847
848 if ( empty( $url ) ) {
849 /*
850 * @todo: Set $url to empty string once supported by SimplePie.
851 *
852 * The early return without proceeding is to work around a PHP 8.5
853 * deprecation issue resolved in https://github.com/simplepie/simplepie/pull/949
854 *
855 * To avoid the duplicate code, this block can be replaced with `$url = '';` once SimplePie
856 * is upgraded to a version that includes the fix.
857 */
858 $feed->init();
859 $feed->set_output_encoding( get_bloginfo( 'charset' ) );
860
861 if ( $feed->error() ) {
862 return new WP_Error( 'simplepie-error', $feed->error() );
863 }
864
865 return $feed;
866 } elseif ( is_array( $url ) && count( $url ) === 1 ) {
867 $url = array_shift( $url );
868 } elseif ( is_array( $url ) ) {
869 $feeds = array();
870 $simplepie_errors = array();
871 foreach ( $url as $feed_url ) {
872 $simplepie_instance = clone $feed;
873 $simplepie_instance->set_feed_url( $feed_url );
874 $simplepie_instance->init();
875 $simplepie_instance->set_output_encoding( get_bloginfo( 'charset' ) );
876
877 if ( $simplepie_instance->error() ) {
878 $simplepie_errors[] = sprintf(
879 /* translators: %1$s is the feed URL, %2$s is the error message. */
880 __( 'Error fetching feed %1$s: %2$s' ),
881 esc_url( $feed_url ),
882 $simplepie_instance->error()
883 );
884 unset( $simplepie_instance );
885 continue;
886 }
887
888 $feeds[] = $simplepie_instance;
889 unset( $simplepie_instance );
890 }
891
892 if ( ! empty( $simplepie_errors ) ) {
893 return new WP_Error( 'simplepie-error', $simplepie_errors );
894 }
895
896 $feed->init();
897 $feed->data['items'] = SimplePie\SimplePie::merge_items( $feeds );
898 return $feed;
899 }
900
901 $feed->set_feed_url( $url );
902 $feed->init();
903 $feed->set_output_encoding( get_bloginfo( 'charset' ) );
904
905 if ( $feed->error() ) {
906 return new WP_Error( 'simplepie-error', $feed->error() );
907 }
908
909 return $feed;
910}
911