Skip Navigation

[Resolved] Add Author in View Search Filter

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Karachi (GMT+05:00)

This topic contains 4 replies, has 2 voices.

Last updated by chalermpongK 1 year ago.

Assisted by: Waqar.



I would like to add Author in View Search Filter. Please let me know, how can I do that?



Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)



Thank you for contacting us and I'd be happy to assist.

The post author search field is something that is not supported out of the box, so this will require some workaround:

1. You'll first register a custom shortcode, that can create a select/drop-down field for the post authors.

add_shortcode("list-of-authors", "list_of_authors");
function list_of_authors() {
	$out = '<select name="author-filter" class="js-wpv-filter-trigger form-control"><option value="">-select-</option>';
	$users = get_users();
	$selected = "";
		$selected = $_GET['author-filter'];
	foreach ($users as $user) {
		$out .= '<option value="' . $user->ID . '" ' . selected( $selected, $user->ID, false ) . '>' . $user->display_name . '</option>';
	$out .= '</select>';
	return $out;

The above code snippet can be included through either Toolset's custom code feature ( ref: ) or through the active theme's "functions.php" file.

2. Next, you can include this shortcode through a "Fields and Text" block, within your view's "View Search" block, where you'd like to show this author search field:
( example screenshot attached: screenshot-post-author-search.png )


3. The last step would be to add a 'post author' query filter in the view's 'Content Selection' section so that it can be linked to the post author ID passed through the URL parameter 'author-filter', coming from the post author search field.
( example screenshot attached: screenshot-post-author-query-filter.png )

I hope this helps and please let me know if you need any further assistance with this.



Thank you for the solution. However, "Fields and Text" currently has an issue with WordPress 6.1 and downgrade is not my option. Could you please let me know if there are other solutions without "Fields and Text", or I have to wait for "Fields and Text" issue has been fixed.



Languages: English (English )

Timezone: Asia/Karachi (GMT+05:00)

Thanks for writing back.

You don't necessarily have to use the "Fields and Text" block to make this shortcode work. As an alternative, you can use the "Shortcode" block or the simple "Custom HTML" block.


My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.