About the param of the admin_enqueue_scripts hook in WordPress
The typical code using admin_enqueue_scripts is
add_action( 'admin_enqueue_scripts', 'enqueue_assets');
function enqueue_assets( $suffix ) {
The question is what the param suffix refer to? After adding a 'echo' sentence, I got the print.
function enqueue_assets( $suffix ) {
echo $suffix;
The print is:
settings_page_baidu-translator
The id of the page added by add_option_page is 'baidu-translator'. So the param suffix refers to a screen id which consists of the id of parent page and current option page.
add_action( 'admin_enqueue_scripts', 'enqueue_assets');
function enqueue_assets( $suffix ) {
wp_enqueue_style( 'baidu-translator-admin' );
} The question is what the param suffix refer to? After adding a 'echo' sentence, I got the print.
function enqueue_assets( $suffix ) {
echo $suffix;
wp_enqueue_style( 'baidu-translator-admin' );
} The print is:
settings_page_baidu-translator
The id of the page added by add_option_page is 'baidu-translator'. So the param suffix refers to a screen id which consists of the id of parent page and current option page.
评论
发表评论