Tribe__Events__Pro__Editor::register_additional_fields_category_all( array<array> $categories, WP_Block_Editor_Context $context )

Add the event custom fields on post that are events only


Parameters

$categories

(<span class="array<arrayarray<array<string|>">string>>) (Required) An array of categories each an array in the format property => value.

$context

(WP_Block_Editor_Context) (Required) The Block Editor Context object. In WP versions prior to 5.8 this was the post object.


Top ↑

Return

(array)


Top ↑

Source

File: src/Tribe/Editor.php

	public function register_additional_fields_category_all( $categories, $context ) {
		if ( ! $context instanceof WP_Block_Editor_Context ) {
			return $categories;
		}

		// Make sure we have the post available.
		if ( empty( $context->post ) ) {
			return $categories;
		}

		// Make sure it's an event post.
		if ( ! tribe_is_event( $context->post ) ) {
			return $categories;
		}

		return array_merge(
			$categories,
			[
				[
					'slug'  => 'tribe-events-pro-additional-fields',
					'title' => __( 'Additional Fields', 'events-pro' ),
				],
			]
		);
	}

Top ↑

Changelog

Changelog
Version Description
4.5 Introduced.