LLMS_Form_Templates::find_reusable_block( string $field_id )

Locates an existing wp_block post by field id


Parameters Parameters

$field_id

(string) (Required) The field's identifier as found in the block schema list returned by LLMS_Form_Templates::get_reusable_block_schema().


Top ↑

Return Return

(WP_Post|boolean) Returns the post object or false if not found.


Top ↑

Source Source

File: includes/forms/class-llms-form-templates.php

	public static function find_reusable_block( $field_id ) {

		$query = new WP_Query(
			array(
				'posts_per_page' => 1,
				'no_found_rows'  => true,
				'post_type'      => 'wp_block',
				'meta_key'       => '_llms_field_id',
				'meta_value'     => $field_id,
			)
		);

		return $query->posts ? $query->posts[0] : false;

	}


Top ↑

Changelog Changelog

Changelog
Version Description
5.1.0 Method access changed from private to public.
5.0.0 Introduced.

Top ↑

User Contributed Notes User Contributed Notes

You must log in before being able to contribute a note or feedback.