Skip to content

Commit

Permalink
Add new filters for manipulating supported posts
Browse files Browse the repository at this point in the history
These filters allow more control over what posts are exported
en masse and whether individual posts should be exported.

Closes #119.
  • Loading branch information
mAAdhaTTah committed Jan 18, 2016
1 parent fe66bf4 commit 416d344
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ This change log follows the [Keep a Changelog standards]. Versions follows [Sema

### [Unreleased] ###

* New filters:
* `wpghs_pre_fetch_all_supported`: Filter the query args before all supported posts are queried.
* `wpghs_is_post_supported`: Determines whether the post is supported by importing/exporting.
* Bugfix: Set secret to password field. See [#124].
* Bugfix: Fix error when importing branch-deletion webhooks.
* Bugfix: Fix "semaphore is locked" response from webhook. See [#121].
Expand Down
8 changes: 5 additions & 3 deletions lib/database.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,14 @@ public function __construct( WordPress_GitHub_Sync $app ) {
* @return WordPress_GitHub_Sync_Post[]|WP_Error
*/
public function fetch_all_supported() {
$query = new WP_Query( array(
$args = array(
'post_type' => $this->get_whitelisted_post_types(),
'post_status' => $this->get_whitelisted_post_statuses(),
'nopaging' => true,
'fields' => 'ids',
) );
);

$query = new WP_Query( apply_filters( 'wpghs_pre_fetch_all_supported', $args ) );

$post_ids = $query->get_posts();

Expand Down Expand Up @@ -338,7 +340,7 @@ protected function is_post_supported( WordPress_GitHub_Sync_Post $post ) {
return false;
}

return true;
return apply_filters( 'wpghs_is_post_supported', true, $post );
}

/**
Expand Down

0 comments on commit 416d344

Please sign in to comment.