Skip to content

Commit e801b96

Browse files
author
hsehszroc
committed
Code review
1 parent 5be9833 commit e801b96

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

Includes/Helper/Filter.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public static function for( string $post_type ) {
149149
/**
150150
* Adds filter dropdown.
151151
*
152-
* #### It's better to use API:
152+
* #### It's better to use API {@see filter_post_list_by()} as below instead of using this method:
153153
* ```
154154
* use function TheWebSolver\Register\filter_post_list_by;
155155
* filter_post_list_by( string $post_type, $keys = '' );
@@ -161,8 +161,8 @@ public static function for( string $post_type ) {
161161
* * Can be useful, in some cases, to run this method if not using API.
162162
*
163163
* **How to use this?**
164-
* * Should be used with `restrict_manage_posts` action hook.
165-
* * Run inside the hooked function to add filtration dropdown.
164+
* * Hook with `admin_init` to parse query.
165+
* * Hook with `restrict_manage_posts` to add filter.
166166
*
167167
* @param string $post_type **required** Post type key.
168168
* @param string $key **required** Taxonomy/Post Meta key to use for adding filteration dropdown.
@@ -271,9 +271,8 @@ public function with_keys( string $post_type ) {
271271
*
272272
* @param string $post_type **required** Post type key.
273273
* @param string $key Taxonomy/Post Meta key to use for adding filteration dropdown.
274-
* @param bool $post_meta Whether param _$key_ belongs to `{$prefix}_postmeta` table or `{$prefix}_posts` table. Defaults to `true`. i.e. belongs to `{$prefix}_postmeta` table (the **$key** is a custom meta key of the **$post_type**).
275274
*
276-
* @return string
275+
* @return string|void|null
277276
*
278277
* @since 1.0
279278
*
@@ -477,14 +476,13 @@ private static function _by_meta( string $post_type, string $meta_key, array $po
477476
* WPHOOK: Filter-> Modify how the options is outputted.
478477
*
479478
* @param string $options
480-
* @param string[] $meta_key
481479
* @param string $selected
482480
*
483481
* @var string[]
484482
*
485483
* @since 1.0
486484
*/
487-
$options = apply_filters( "hzfex_{$meta_key}_query_dropdown_result", $options, $meta_key, $selected );
485+
$options = apply_filters( "hzfex_{$meta_key}_query_dropdown_result", $options, $selected );
488486

489487
// Outputs the select dropdown filtering.
490488
echo '<select class="" id="'.$meta_key.'" name="'.$meta_key.'">';

0 commit comments

Comments
 (0)