How to load an assets based on custom field value?
You would want to use the wp_enqueue_scripts action, and within there, instead of custom_field you would use get_post_meta, like this: function wpse217823_enqueue_per_custom_field(){ global $post; $layout = get_post_meta( $post->ID, ‘layout’, true ); if( $layout == … ){ wp_enqueue_style( ‘my-custom-style-here’ ); } } add_action( ‘wp_enqueue_scripts’, ‘wpse217823_enqueue_per_custom_field’ );