@@ -15,7 +15,7 @@ class Yoast_ACF_Analysis_Assets {
1515 public function init () {
1616 $ this ->plugin_data = get_plugin_data ( AC_SEO_ACF_ANALYSIS_PLUGIN_FILE );
1717
18- add_filter ( 'admin_enqueue_scripts ' , array ( $ this , 'enqueue_scripts ' ) );
18+ add_filter ( 'admin_enqueue_scripts ' , array ( $ this , 'enqueue_scripts ' ), 11 );
1919 }
2020
2121 /**
@@ -28,27 +28,30 @@ public function enqueue_scripts() {
2828 $ config = Yoast_ACF_Analysis_Facade::get_registry ()->get ( 'config ' );
2929
3030 // Post page enqueue.
31- if ( ' post.php ' === $ pagenow || 'post-new.php ' === $ pagenow ) {
31+ if ( wp_script_is ( WPSEO_Admin_Asset_Manager:: PREFIX . 'post-scraper ' ) ) {
3232 wp_enqueue_script (
3333 'yoast-acf-analysis-post ' ,
3434 plugins_url ( '/js/yoast-acf-analysis.js ' , AC_SEO_ACF_ANALYSIS_PLUGIN_FILE ),
35- array ( 'jquery ' , 'yoast-seo-post-scraper ' , 'underscore ' ),
36- $ this ->plugin_data ['Version ' ]
35+ array ( 'jquery ' , WPSEO_Admin_Asset_Manager::PREFIX . 'post-scraper ' , 'underscore ' ),
36+ $ this ->plugin_data ['Version ' ],
37+ true
3738 );
3839
3940 wp_localize_script ( 'yoast-acf-analysis-post ' , 'YoastACFAnalysisConfig ' , $ config ->to_array () );
4041 }
4142
4243 // Term page enqueue.
43- if ( 'term.php ' === $ pagenow ) {
44+ if ( wp_script_is ( WPSEO_Admin_Asset_Manager:: PREFIX . 'term-scraper ' ) ) {
4445 wp_enqueue_script (
4546 'yoast-acf-analysis-term ' ,
4647 plugins_url ( '/js/yoast-acf-analysis.js ' , AC_SEO_ACF_ANALYSIS_PLUGIN_FILE ),
47- array ( 'jquery ' , 'yoast-seo-term-scraper ' ),
48- $ this ->plugin_data ['Version ' ]
48+ array ( 'jquery ' , WPSEO_Admin_Asset_Manager::PREFIX . 'term-scraper ' ),
49+ $ this ->plugin_data ['Version ' ],
50+ true
4951 );
5052
5153 wp_localize_script ( 'yoast-acf-analysis-term ' , 'YoastACFAnalysisConfig ' , $ config ->to_array () );
5254 }
5355 }
56+
5457}
0 commit comments