AnsPress_Rewrite::alter_the_query( array $request )

Description #

Filter global request array.

Parameters #

  • $request
    array (Required) Request array.

Changelog #

VersionDescription
4.1.0Introduced.

Source #

File: includes/rewrite.php

	public static function alter_the_query( $request ) {
		if ( isset( $request['post_type'] ) && 'answer' === $request['post_type'] ) {
			if ( ! empty( $request['feed'] ) ) {
				unset( $request['question_id'] );
				unset( $request['answer'] );
			}

			if ( isset( $request['embed'] ) && 'true' === $request['embed'] ) {
				$request['p'] = $request['answer_id'];
			}
		}

		return $request;
	}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment