Changes between Initial Version and Version 1 of Ticket #41714, comment 1
- Timestamp:
- 08/25/2017 01:33:41 PM (7 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #41714, comment 1
initial v1 1 If I understand correctly you want more control over core `get_post ()` method so that you can build a query with specific '''"WHERE"''' filters in order to fetch the type of records you want, not just '''"ALL"''' posts.1 If I understand correctly you want more control over core `get_posts()` method so that you can build a query with specific '''"WHERE"''' filters in order to fetch the type of records you want, not just '''"ALL"''' posts. 2 2 3 To achieve this you have the option to build an array and pass it through `$args` parameter `get_post ()` (`function get_posts( $args = null ) { ... }`) method, which by default is set to null. If you do not pass any argument, all posts would be retrieved while if you have a properly built argument, `get_post()` will use this to fetch matching records according to criteria you set in the query.3 To achieve this you have the option to build an array and pass it through `$args` parameter `get_posts()` (`function get_posts( $args = null ) { ... }`) method, which by default is set to null. If you do not pass any argument, all posts would be retrieved while if you have a properly built argument, `get_posts()` will use this to fetch matching records according to criteria you set in the query. 4 4 5 5 [https://developer.wordpress.org/reference/functions/get_posts/]