I was trying to get conditional output working based on a custom function but no luck, even though just outputting the result in a text field worked. Then I remembered that some improvements to this had been made in 1.8 so I figured I’d take it for a spin.
I updated bricks (from 1.7.3 to 1.8) and also tried just freshly uploading the 1.8 version. Now, every time I try to save my functions.php in my child theme I get an error. At first I thought I must have messed up something but even removing everything except for the default bricks-child stuff, it just won’t let me save and the error does refer to a file in the parent theme.
Here is the full error:
Your PHP code changes were rolled back due to an error on line 151 of file wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php. Please fix and try saving again.
Uncaught TypeError: str_replace(): Argument #2 ($replace) must be of type array|string, WP_Error given in wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php:151
Stack trace:
#0 wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php(151): str_replace()
#1 wp-includes/class-wp-hook.php(308): Bricks\Integrations\Dynamic_Data\Providers->render()
#2 wp-includes/plugin.php(205): WP_Hook->apply_filters()
#3 wp-content/themes/bricks/includes/integrations/dynamic-data/providers.php(260): apply_filters()
#4 wp-content/themes/bricks/functions.php(199): Bricks\Integrations\Dynamic_Data\Providers::render_content()
#5 wp-content/themes/bricks/includes/elements/base.php(1819): bricks_render_dynamic_data()
#6 wp-content/themes/bricks/includes/elements/base.php(1458): Bricks\Element->set_link_attributes()
#7 wp-content/themes/bricks/includes/elements/base.php(2124): Bricks\Element->set_root_attributes()
#8 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#9 wp-content/themes/bricks/includes/elements/container.php(854): Bricks\Frontend::render_element()
#10 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#11 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#12 [internal function]: Bricks\Frontend::render_element()
#13 wp-content/themes/bricks/includes/query.php(876): call_user_func_array()
#14 wp-content/themes/bricks/includes/elements/container.php(774): Bricks\Query->render()
#15 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#16 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#17 wp-content/themes/bricks/includes/elements/container.php(854): Bricks\Frontend::render_element()
#18 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#19 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#20 wp-content/themes/bricks/includes/elements/container.php(854): Bricks\Frontend::render_element()
#21 wp-content/themes/bricks/includes/elements/base.php(2158): Bricks\Element_Container->render()
#22 wp-content/themes/bricks/includes/frontend.php(440): Bricks\Element->init()
#23 wp-content/themes/bricks/includes/frontend.php(526): Bricks\Frontend::render_element()
#24 wp-content/themes/bricks/includes/frontend.php(775): Bricks\Frontend::render_data()
#25 wp-content/themes/bricks/page.php(7): Bricks\Frontend::render_content()
#26 wp-includes/template-loader.php(106): include('/home/935317.cl...')
#27 wp-blog-header.php(19): require_once('/home/935317.cl...')
#28 index.php(17): require('/home/935317.cl...')
#29 {main}
thrown
Just tested this again on a fresh 1.8 install and the problem didn’t occur. I must have messed up somehwere just no clue where. Got loads of dynamic data stuff on the site with the issue, so if there is a way to figure it out without me basically removing every single dynamic data tag that would be great but if there isn’t I guess I’ll have to go through all of them.