rob8
Forum Replies Created
-
Thanks for the answer and sorry for my very late reply.
Chromium shows an JS error, but that one appears no matter if the shortcode is available or not and no matter if the error occurs or not:
`react-dom.js?ver=16.6.3:500 Warning: Unsafe lifecycle methods were found within a strict-mode tree:
in StrictMode (created by Editor)
in Editor (created by ComponentWithSelect)
in ComponentWithSelect (created by Context.Consumer)
in WithSelect(Editor)componentWillUpdate: Please update the following components to use componentDidUpdate instead: FillComponent
Learn more about this warning here:
https://fb.me/react-strict-mode-warnings
</blockquote>It seems like the error would be caused by
wp_print_scriptsin these two lines:
<blockquote> wp_enqueue_script(‘google-maps-api’, ‘//maps.google.com/maps/api/js?key=’.sanitize_text_field($key));
wp_print_scripts(‘google-maps-api’);</blockquote>Removing
wp_print_scriptsgets rid of the error but also breaks the map. I used the function because it was suggested here: https://developer.ww.wp.xz.cn/reference/functions/wp_print_scripts/ however this site states it would be deprecated: https://codex.ww.wp.xz.cn/Plugin_API/Action_Reference/wp_print_scripts. The linked “help” page https://make.ww.wp.xz.cn/core/2011/12/12/use-wp_enqueue_scripts-not-wp_print_styles-to-enqueue-scripts-and-styles-for-the-frontend/ is not really helpful for me at all, since the suggested fix, just usingwp_enqueue_scriptwithoutwp_print_scriptsbreaks the map (not displayed at all).- This reply was modified 7 years, 2 months ago by rob8. Reason: format