|
@@ 1283-1295 (lines=13) @@
|
| 1280 |
|
$args['post_status'] = $post_statuses; |
| 1281 |
|
|
| 1282 |
|
// if we are trying to match to a meta field, the method is an object |
| 1283 |
|
if ( class_exists( $method ) ) { |
| 1284 |
|
unset( $args[ $key ] ); |
| 1285 |
|
$args['meta_query'] = array( |
| 1286 |
|
array( |
| 1287 |
|
'key' => $key, |
| 1288 |
|
'value' => $value, |
| 1289 |
|
), |
| 1290 |
|
); |
| 1291 |
|
$match_query = new $method( $args ); |
| 1292 |
|
$posts = $match_query->get_results(); |
| 1293 |
|
} else { |
| 1294 |
|
$posts = $method( $args ); |
| 1295 |
|
} |
| 1296 |
|
|
| 1297 |
|
if ( isset( $posts ) && isset( $posts[0]->{$id_field} ) ) { |
| 1298 |
|
// Post does exist after checking the matching value. We want its id. |
|
@@ 1603-1615 (lines=13) @@
|
| 1600 |
|
$args['post_type'] = 'attachment'; |
| 1601 |
|
|
| 1602 |
|
// if we are trying to match to a meta field, the method is an object |
| 1603 |
|
if ( class_exists( $method ) ) { |
| 1604 |
|
unset( $args[ $key ] ); |
| 1605 |
|
$args['meta_query'] = array( |
| 1606 |
|
array( |
| 1607 |
|
'key' => $key, |
| 1608 |
|
'value' => $value, |
| 1609 |
|
), |
| 1610 |
|
); |
| 1611 |
|
$match_query = new $method( $args ); |
| 1612 |
|
$posts = $match_query->get_results(); |
| 1613 |
|
} else { |
| 1614 |
|
$posts = $method( $args ); |
| 1615 |
|
} |
| 1616 |
|
|
| 1617 |
|
if ( isset( $posts ) && isset( $posts[0]->{$id_field} ) ) { |
| 1618 |
|
// Attachment does exist after checking the matching value. we want its id. |