diff --git src/wp-includes/comment.php src/wp-includes/comment.php
index ef4b553..a5e4084 100644
|
|
function do_all_pings() { |
2267 | 2267 | global $wpdb; |
2268 | 2268 | |
2269 | 2269 | // Do pingbacks |
2270 | | while ($ping = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_pingme' LIMIT 1")) { |
2271 | | delete_metadata_by_mid( 'post', $ping->meta_id ); |
| 2270 | $pings = get_posts( array( 'post_type' => 'any', 'posts_per_page' => -1, 'meta_value' => '_pingme' ) ); |
| 2271 | foreach ( $pings as $ping ) { |
| 2272 | delete_post_meta( $ping->ID, '_pingme' ); |
2272 | 2273 | pingback( $ping->post_content, $ping->ID ); |
2273 | 2274 | } |
2274 | 2275 | |
2275 | 2276 | // Do Enclosures |
2276 | | while ($enclosure = $wpdb->get_row("SELECT ID, post_content, meta_id FROM {$wpdb->posts}, {$wpdb->postmeta} WHERE {$wpdb->posts}.ID = {$wpdb->postmeta}.post_id AND {$wpdb->postmeta}.meta_key = '_encloseme' LIMIT 1")) { |
2277 | | delete_metadata_by_mid( 'post', $enclosure->meta_id ); |
| 2277 | $enclosures = get_posts( array( 'post_type' => 'any', 'posts_per_page' => -1, 'meta_value' => '_encloseme' ) ); |
| 2278 | foreach ( $enclosures as $enclosure ) { |
| 2279 | delete_post_meta( $enclosure->ID, '_encloseme' ); |
2278 | 2280 | do_enclose( $enclosure->post_content, $enclosure->ID ); |
2279 | 2281 | } |
2280 | 2282 | |
2281 | 2283 | // Do Trackbacks |
2282 | | $trackbacks = $wpdb->get_col("SELECT ID FROM $wpdb->posts WHERE to_ping <> '' AND post_status = 'publish'"); |
2283 | | if ( is_array($trackbacks) ) |
2284 | | foreach ( $trackbacks as $trackback ) |
2285 | | do_trackbacks($trackback); |
| 2284 | $trackbacks = get_posts( array( 'post_type' => 'any', 'posts_per_page' => -1, 'to_ping' => true, 'fields' => 'ids' ) ); |
| 2285 | foreach ( $trackbacks as $trackback ) { |
| 2286 | do_trackbacks( $trackback ); |
| 2287 | } |
2286 | 2288 | |
2287 | 2289 | //Do Update Services/Generic Pings |
2288 | 2290 | generic_ping(); |
diff --git src/wp-includes/query.php src/wp-includes/query.php
index 077e7ed..8b206bf 100644
|
|
class WP_Query { |
1570 | 1570 | * @type array $tax_query An associative array of WP_Tax_Query arguments. |
1571 | 1571 | * See WP_Tax_Query->queries. |
1572 | 1572 | * @type string $title Post title. |
| 1573 | * @type string $to_ping Post ping status. Default false. |
1573 | 1574 | * @type bool $update_post_meta_cache Whether to update the post meta cache. Default true. |
1574 | 1575 | * @type bool $update_post_term_cache Whether to update the post term cache. Default true. |
1575 | 1576 | * @type bool $lazy_load_term_meta Whether to lazy-load term meta. Setting to false will |
… |
… |
class WP_Query { |
1608 | 1609 | $qv['pagename'] = trim( $qv['pagename'] ); |
1609 | 1610 | $qv['name'] = trim( $qv['name'] ); |
1610 | 1611 | $qv['title'] = trim( $qv['title'] ); |
| 1612 | |
1611 | 1613 | if ( '' !== $qv['hour'] ) $qv['hour'] = absint($qv['hour']); |
1612 | 1614 | if ( '' !== $qv['minute'] ) $qv['minute'] = absint($qv['minute']); |
1613 | 1615 | if ( '' !== $qv['second'] ) $qv['second'] = absint($qv['second']); |
… |
… |
class WP_Query { |
2567 | 2569 | else |
2568 | 2570 | $q['post_type'] = ''; |
2569 | 2571 | } |
| 2572 | if ( ! isset( $q['to_ping'] ) ) { |
| 2573 | $q['to_ping'] = false; |
| 2574 | } |
2570 | 2575 | $post_type = $q['post_type']; |
2571 | 2576 | if ( empty( $q['posts_per_page'] ) ) { |
2572 | 2577 | $q['posts_per_page'] = get_option( 'posts_per_page' ); |
… |
… |
class WP_Query { |
3089 | 3094 | $post_type_object = get_post_type_object ( 'post' ); |
3090 | 3095 | } |
3091 | 3096 | |
| 3097 | if ( $q['to_ping'] ) { |
| 3098 | $where .= " AND {$wpdb->posts}.to_ping <> ''"; |
| 3099 | } |
| 3100 | |
3092 | 3101 | $edit_cap = 'edit_post'; |
3093 | 3102 | $read_cap = 'read_post'; |
3094 | 3103 | |
diff --git tests/phpunit/tests/post/query.php tests/phpunit/tests/post/query.php
index 0ede881..f3fc546 100644
|
|
class Tests_Post_Query extends WP_UnitTestCase { |
388 | 388 | $actual_posts = $q->get_posts(); |
389 | 389 | $this->assertEqualSets( $requested, $actual_posts ); |
390 | 390 | } |
| 391 | |
| 392 | /** |
| 393 | * Tests the to_ping attribute of WP_Query. |
| 394 | * |
| 395 | * @ticket 36824 |
| 396 | */ |
| 397 | public function test_to_ping() { |
| 398 | $q = new WP_Query(); |
| 399 | |
| 400 | $post_ids[0] = self::factory()->post->create( array( |
| 401 | 'to_ping' => 'http://www.example.com' ) ); |
| 402 | $q->query( array( |
| 403 | 'to_ping' => '', |
| 404 | 'fields' => 'ids' ) ); |
| 405 | $actual_posts = $q->get_posts(); |
| 406 | $this->assertSame( $post_ids, $actual_posts ); |
| 407 | } |
| 408 | |
391 | 409 | |
392 | 410 | /** |
393 | 411 | * @ticket 36687 |