searchwp\swp_query\args
4.0.0以降
SWP_Queryをインスタンス化する際に使用される引数を変更します。
パラメータ
| タイプ | パラメータ | デフォルト | 提供開始 |
|---|---|---|---|
| 配列 | $args |
このインスタンス化のための送信済み引数 | 4.0.0 |
例
All hooks should be added to your custom SearchWP Customizations Plugin.
結果を投稿とページに制限する
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| // Restrict results to Posts and Pages for SearchWP's SWP_Query. | |
| add_filter( 'searchwp\swp_query\args', function( $args ) { | |
| $args['post_type'] = [ 'post', 'page' ]; | |
| return $args; | |
| } ); |

