Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unique Post System usage resulting in error in SiteOrigin Page Builder #95

Open
AlexGStapleton opened this issue Apr 2, 2022 · 1 comment

Comments

@AlexGStapleton
Copy link

The Unique Post System setting will result in a fatal error message when a widget that uses it is added using SiteOrigin Page Builder.

Fatal error: Uncaught TypeError: array_merge(): Argument #1 must be of type array, null given in /home/***/public_html/wp-content/themes/colormag-pro/inc/template-tags.php:167 Stack trace: #0 /home/***/public_html/wp-content/themes/colormag-pro/inc/template-tags.php(167): array_merge() #1 /home/***/public_html/wp-content/themes/colormag-pro/inc/widgets/colormag-featured-posts-slider-widget.php(171): colormag_append_excluded_duplicate_posts() #2 /home/***/public_html/wp-content/plugins/siteorigin-panels/inc/renderer.php(717): colormag_featured_posts_slider_widget->widget() #3 /home/***/public_html/wp-content/plugins/siteorigin-panels/inc/renderer.php(1059): SiteOrigin_Panels_Renderer->the_widget() #4 /home/***/public_html/wp-content/plugins/siteorigin-panels/inc/renderer.php(1024): SiteOrigin_Panels_Renderer->render_widget() #5 /home/***/public_html/wp-content/plugins/siteorigin-panels/inc/renderer.php(936): SiteOrigin_Panels_Renderer->render_cell() #6 /home/***/public_html/wp-content/plugins/siteorigin-panels/inc/renderer.php(491): SiteOrigin_Panels_Renderer->render_row() #7 /home/***/public_html/wp-content/plugins/siteorigin-panels/inc/admin.php(1095): SiteOrigin_Panels_Renderer->render() #8 /home/***/public_html/wp-content/plugins/siteorigin-panels/inc/admin.php(209): SiteOrigin_Panels_Admin->generate_panels_preview() #9 /home/***/public_html/wp-admin/includes/template.php(1395): SiteOrigin_Panels_Admin->render_meta_boxes() #10 /home/***/public_html/wp-admin/edit-form-advanced.php(711): do_meta_boxes() #11 /home/***/public_html/wp-admin/post.php(206): require('/home/***/...') #12 {main} thrown in /home/***/public_html/wp-content/themes/colormag-pro/inc/template-tags.php on line 167

This appears to be due to the $colormag_duplicate_posts not being detected correctly. Likely due to the global not being able to be passed down the chain. Storing it using query var (or something like that) may account for not only this issue but any similar type of usage. Due to how this issue could be fixed in a few different ways I haven't come up with a fix. I would be happy to come up with one and submit it to any repo, or for someone else to submit it on my behalf.

@AlexGStapleton
Copy link
Author

A straight forward fix (although potentially not the best) would be to open wp-content/themes/colormag-pro/inc/template-tags.php and find:

if ( ! function_exists( 'colormag_append_excluded_duplicate_posts' ) ) :

Add to the previous line:

$colormag_duplicate_posts = array();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant