elementor / elementor

The most advanced frontend drag & drop page builder. Create high-end, pixel perfect websites at record speeds. Any theme, any page, any design.

Home Page:https://elementor.com/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Conditional Display with ACF relationship field

thedesigngroup opened this issue · comments

Prerequisites

  • I have searched for similar issues in open and closed tickets and cannot find a duplicate.
  • I have troubleshooted my issue, and it still exists against the latest stable version of Elementor.

Description

If you use a relationship field as the display conditional, and a operator of "is empty" or "is not empty", elementor gets the value of the field using the post id, then checks it againts a function that requires the value to be a string, but since it a relationship field, it returns an array. This causes the function to fail.

I have created a screencast here

https://www.loom.com/share/5cc92f5e2682472187f49e2bb4fb5ac0?sid=2eb7ead8-db8a-477c-8fcd-9ce1f6b86318

https://blank.elementor.tdgrepo.com/index.php/2024/05/15/post-3-with-relation/

Steps to reproduce

create relationship field in ACF and add it the default "post" type
then add it to a post
then create a single post template, adding a section that is display conditionaly
then set it to "Dynamic Tags" then select your custom field slug, then set compare to is empty or is not empty.
then save the template and assign it to all posts.
then vire the post

Expected behavior

when the field is checked for empty/not empty it should be able to check arrays and strings

if the empty(array) is false then it is not empty
if the empty(array) is true then it is empty

Isolating the problem

  • This bug happens when only the Elementor (and Elementor Pro) plugins are active.
  • This bug happens with the Hello Elementor theme active.
  • I can reproduce this bug consistently by following the steps I described above.

Elementor System Info

Click to reveal
== Server Environment ==
	Operating System: Linux
	Software: Apache
	MySQL version: MySQL Community Server - GPL v8.0.37
	PHP Version: 8.1.28
	PHP Memory Limit: 512M
	PHP Max Input Vars: 1000
	PHP Max Post Size: 20M
	GD Installed: Yes
	ZIP Installed: Yes
	Write Permissions: All right
	Elementor Library: Connected

== WordPress Environment ==
	Version: 6.5.3
	Site URL: https://blank.elementor.tdgrepo.com
	Home URL: https://blank.elementor.tdgrepo.com
	WP Multisite: No
	Max Upload Size: 20 MB
	Memory limit: 40M
	Max Memory limit: 512M
	Permalink Structure: /index.php/%year%/%monthnum%/%day%/%postname%/
	Language: en_US
	Timezone: 0
	Debug Mode: Active

== Theme ==
	Name: Hello Elementor
	Version: 3.0.1
	Author: Elementor Team
	Child Theme: No

== User ==
	Role: administrator
	WP Profile lang: en-US
	User Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36

== Active Plugins ==
	Advanced Custom Fields PRO
		Version: 6.2.10
		Author: WP Engine

	Elementor
		Version: 3.21.5
		Author: Elementor.com

	Elementor Pro
		Version: 3.21.2
		Author: Elementor.com


== Elements Usage ==
	
	wp-post : 4
		container : 1
		heading : 1
	single-post : 1
		container : 6
		heading : 5
		theme-post-content : 1
		theme-post-title : 1


== Settings ==
	
	allow_tracking: yes
	font_display: swap


== Features ==
	Custom Fonts: 0
	Custom Icons: 0

== Integrations ==
	


== Elementor Experiments ==
	Improved Asset Loading: Active by default
	Improved CSS Loading: Active by default
	Inline Font Icons: Active by default
	Additional Custom Breakpoints: Active by default
	admin_menu_rearrangement: Inactive by default
	Flexbox Container: Active by default
	Upgrade Swiper Library: Active by default
	Grid Container: Active by default
	Nested Elements Performance: Inactive by default
	Optimized Control Loading: Inactive by default
	Default to New Theme Builder: Active by default
	Hello Theme Header & Footer: Active by default
	Elementor Home Screen: Active by default
	Editor Top Bar: Inactive by default
	Build with AI: Active by default
	Landing Pages: Active by default
	Nested Elements: Inactive by default
	Lazy Load Background Images: Active by default
	Display Conditions: Active by default
	Form Submissions: Active by default
	Menu: Inactive by default
	Taxonomy Filter: Active by default


== Log ==
	
PHP: showing 1 of 1PHP: 2024-05-15 15:09:54 [error X 2][../wp-content/plugins/elementor-pro/modules/display-conditions/classes/comparators-checker.php::76] Uncaught TypeError: ElementorPro\Modules\DisplayConditions\Classes\Comparators_Checker::check_string_contains_and_empty(): Argument #3 ($actual_value) must be of type string, array given, called in ../wp-content/plugins/elementor-pro/modules/display-conditions/conditions/dynamic-tags-condition.php on line 54 and defined in ../wp-content/plugins/elementor-pro/modules/display-conditions/classes/comparators-checker.php:76
Stack trace:
#0 ../wp-content/plugins/elementor-pro/modules/display-conditions/conditions/dynamic-tags-condition.php(54): ElementorPro\Modules\DisplayConditions\Classes\Comparators_Checker::check_string_contains_and_empty('is_not_empty', '', Array)
#1 ../wp-content/plugins/elementor-pro/modules/display-conditions/classes/and-condition.php(38): ElementorPro\Modules\DisplayConditions\Conditions\Dynamic_Tags_Condition->check(Array)
#2 ../wp-content/plugins/elementor-pro/modules/display-conditions/classes/and-condition.php(24): ElementorPro\Modules\DisplayConditions\Classes\And_Condition->is_condition_passing_check(Array)
#3 ../wp-content/plugins/elementor-pro/modules/display-conditions/classes/or-condition.php(27): ElementorPro\Modules\DisplayConditions\Classes\And_Condition->check()
#4 ../wp-content/plugins/elementor-pro/modules/display-conditions/module.php(188): ElementorPro\Modules\DisplayConditions\Classes\Or_Condition->check()
#5 ../wp-includes/class-wp-hook.php(324): ElementorPro\Modules\DisplayConditions\Module->before_element_render(Object(Elementor\Includes\Elements\Container))
#6 ../wp-includes/class-wp-hook.php(348): WP_Hook->apply_filters('', Array)
#7 ../wp-includes/plugin.php(517): WP_Hook->do_action(Array)
#8 ../wp-content/plugins/elementor/includes/base/element-base.php(455): do_action('elementor/front...', Object(Elementor\Includes\Elements\Container))
#9 ../wp-content/plugins/elementor/core/base/document.php(1795): Elementor\Element_Base->print_element()
#10 ../wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(412): Elementor\Core\Base\Document->print_elements(Array)
#11 ../wp-content/plugins/elementor/includes/frontend.php(1157): ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document->print_elements_with_wrapper(Array)
#12 ../wp-content/plugins/elementor/core/base/document.php(1231): Elementor\Frontend->get_builder_content(42, false)
#13 ../wp-content/plugins/elementor/modules/library/documents/library-document.php(76): Elementor\Core\Base\Document->get_content(false)
#14 ../wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(158): Elementor\Modules\Library\Documents\Library_Document->get_content(false)
#15 ../wp-content/plugins/elementor-pro/modules/theme-builder/documents/theme-document.php(173): ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document->get_content()
#16 ../wp-content/plugins/elementor-pro/modules/theme-builder/documents/single-base.php(93): ElementorPro\Modules\ThemeBuilder\Documents\Theme_Document->print_content()
#17 ../wp-content/plugins/elementor-pro/modules/theme-builder/classes/locations-manager.php(364): ElementorPro\Modules\ThemeBuilder\Documents\Single_Base->print_content()
#18 ../wp-content/plugins/elementor-pro/modules/theme-builder/api.php(13): ElementorPro\Modules\ThemeBuilder\Classes\Locations_Manager->do_location('single')
#19 ../wp-content/themes/hello-elementor/index.php(20): elementor_theme_do_location('single')
#20 ../wp-includes/template-loader.php(106): include('/home/elementor...')
#21 ../wp-blog-header.php(19): require_once('/home/elementor...')
#22 ../index.php(17): require('/home/elementor...')
#23 {main}
  thrown [array (
  'trace' => '
#0: Elementor\Core\Logger\Manager -> shutdown()
',
)]



== Elementor - Compatibility Tag ==
	
	Elementor Pro: Compatible

== Elementor Pro - Compatibility Tag ==

Agreement

  • I agree that my issue may be closed without action if it doesn't meet all the requirements.

+1 This caused a fatal error for me awell. If we are able to select relationship fields in dynamic tags they should work and not produce an error.