-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathtest-data-loader.php
More file actions
33 lines (24 loc) · 892 Bytes
/
test-data-loader.php
File metadata and controls
33 lines (24 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
// Only load data when Plugin API is available because it is not needed in Unit Tests anyway.
if ( function_exists( 'add_action' ) ) {
add_action( 'admin_init', 'yoast_acf_analysis_test_data_loader', 11 );
}
function yoast_acf_analysis_test_data_loader() {
if ( ! defined( 'AC_YOAST_ACF_ANALYSIS_ENVIRONMENT' ) || 'development' !== AC_YOAST_ACF_ANALYSIS_ENVIRONMENT ) {
return;
}
$registry = Yoast_ACF_Analysis_Facade::get_registry();
$configuration = $registry->get( 'config' );
$version = 4;
if ( version_compare( $configuration->get_acf_version(), 5, '>=' ) ) {
$version = 5;
}
require_once AC_SEO_ACF_ANALYSIS_PLUGIN_PATH . '/tests/js/system/data/acf' . $version . '.php';
$args = array(
'public' => false,
'show_ui' => true,
'supports' => array( 'thumbnail' ),
'label' => 'Non Public CPT',
);
register_post_type( 'test_non_public_cpt', $args );
}