Tribe__Events__Rewrite::filter_url_to_postid( string $url )

Prevent url_to_postid to run if on the main events page to avoid query conflicts.

See also


Top ↑

Parameters

$url

(string) (Required) The URL from url_to_postid()


Top ↑

Return

(int|string) $url


Top ↑

Source

File: src/Tribe/Rewrite.php

	public function filter_url_to_postid( $url ) {

		$events_url = Tribe__Events__Main::instance()->getLink();

		// check if the site is using pretty permalinks
		if ( '' !== get_option( 'permalink_structure' ) ) {
			$url_query = @parse_url( $url, PHP_URL_QUERY );

			// Remove the "args" in case we receive any
			if ( ! empty( $url_query ) ) {
				$url = str_replace( '?' . $url_query, '', $url );
			} else {
				// Check if they're viewing the events page with pretty params
				if ( 0 === stripos( $url, $events_url ) ) {
					$url = $events_url;
				}
			}
		}

		if (
			$url === $events_url
			|| $url === Tribe__Events__Main::instance()->getLink( 'month' )
		) {
			return 0;
		}

		return $url;

	}

Top ↑

Changelog

Changelog
Version Description
4.6.15 Introduced.