# Restrict results from the current author archive page

[What is this, and where do I put this custom code?](/safe-coding-guideline.md)

```php
add_action('asp_layout_in_form', 'asp_layout_in_form_author_archive_input', 10);
function asp_layout_in_form_author_archive_input() {
	if ( is_author() ) {
		?>
		<input type="hidden" styl="display:none;" name="asp_author_archive" value="<?php echo get_queried_object_id(); ?>">
		<?php
	}
}


add_filter( 'asp_query_args', 'asp_archive_page_category_restriction', 10, 3 );
function asp_archive_page_category_restriction($args, $search_id, $options) {
	if ( isset($options['asp_author_archive']) ) {
		if ( !isset($args['post_user_filter']['include']) ) {
			$args['post_user_filter']['include'] = array();
		}
		$args['post_user_filter']['include'] = array_unique(array_merge(
			$args['post_user_filter']['include'],
			array($options['asp_author_archive'])
		));
	}
	return $args;
}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://knowledgebase.ajaxsearchpro.com/miscellaneous/other/restrict-results-from-the-current-author-archive-page.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
