We don't expect javascript errors.
When I open JS console, I see error:
_ReferenceError: wpseoPostScraperL10n is not defined_
Install WP core
Install Visual Composer, Yoast SEO plugins
Can you provide a link to a page which shows this issue?
Go to WP dashboard, Visual Composer -> Grid Builder. Try to add new grid template
@TukuTuru Can you confirm procedure? I just reproduced issue on my test server. It's possible source of issue https://wordpress.org/support/topic/grid-builder-visual-composer-conflict/
It seems that issue is related to Visual Composer
file: include/classes/vendors/plugins/class-vc-vendor-yoast_seo.php
/**
* @since 4.4
*/
public function enqueueJs() {
wp_enqueue_script( 'vc_vendor_yoast_js', vc_asset_url( 'js/vendors/yoast.js' ), array( 'yoast-seo-post-scraper' ), WPB_VC_VERSION, true );
}
This function loads post-scraper even if yoast doesn't show meta box.
function enqueueJs should be:
public function enqueueJs() {
if ( wp_script_is( 'yoast-seo-post-scraper' ) ) {
wp_enqueue_script( 'vc_vendor_yoast_js', vc_asset_url( 'js/vendors/yoast.js' ), array( 'yoast-seo-post-scraper' ), WPB_VC_VERSION, true );
}
}
@stodorovic props I tested your suggested edit and all issues are gone automatically with it.
means, also using Types VC-Grid Editor is back on duty.
For me, this here can be closed as this is neither a types nor a YOAST issue
Thanks for your hard commitment here.
I will inform our Compatibility team about your work here, so either you or us we can inform WPBakery - or both, doesn't hurt at all :)
@terw-dan It's related to #5983 We confirmed that VC is loading yoast-seo-post-scraper when Yoast SEO metabox is hidden. Can you look in include/classes/vendors/plugins/class-vc-vendor-yoast_seo.php (Visual composer)?
I tried to fix it with previous snippet, but I'm not sure that works as should. I tested a bit and it works (posts, pages, grid builder). Anyway, we have to contact WPBakery.
@stodorovic
-I also tested the improved function and everything seems to be working great.
-Did anyone report this error to WPBakery?
(I do not have support, because I use Visual Composer with purchased theme)
-Thank you for your time
I'm afraid about order of wp_enqueue functions. It seems that Yoast enqueue scripts before VC and it's fine. If VC function enqueueJs is called before Yoast enqueue then VC doesn't load vc_vendor_yoast_js and it's new issue.
It's reason why asking everyone to test snippet editor on pages, posts,...
Anyway, it's VC issue. I tried to report indirectly (I'm maintaining couple websites where are installed themes with bundled VC)
Great troubleshooting effort @stodorovic - hopefully WPBakery can sort it out, and then we can close 5941 as well.
Please inform the customer of conversation # 173878 when this conversation has been closed.
Waiting for the fix in the plugin.
https://gist.github.com/asadowski10/bd12c86dfbe2a6af2168760a12032ac9
We are going to solve the JavaScript error being a problem, but it is clear that this specific issue can and should be resolved in the VC plugin.
Closing this issue for that reason.
Most helpful comment
function enqueueJs should be: