Event::filter_the_title_display( string $title, int|WP_Post $post_id )

Filter the display of the_title for password protected events, venues, and organizers.


Parameters

$title

(string) (Required) The post title.

$post_id

(int|WP_Post) (Required) The post ID, or object, to apply the filter for.


Top ↑

Return

(string) The post title or empty string if password protected.


Top ↑

Source

File: src/Tribe/Views/V2/Template/Event.php

	public function filter_the_title_display( $title, $post_id = 0 ) {
		$post = get_post( $post_id );

		if ( ! $post instanceof \WP_Post ) {
			return $title;
		}

		if ( empty( $post->post_password ) ) {
			return $title;
		}

		$post_type  = get_post_type( $post_id );
		$post_types = array(
			\Tribe__Events__Main::POSTTYPE,
			\Tribe__Events__Organizer::POSTTYPE,
			\Tribe__Events__Venue::POSTTYPE,
		);

		if ( in_array( $post_type, $post_types, true ) ) {
			return '';
		}

		return $title;
	}

Top ↑

Changelog

Changelog
Version Description
5.3.1 Introduced.