You can find one solution here.
Hello Kurak,
Here is a simple solution to your problem using jQuery:
if ( is_admin() ) {
function add_post_enctype() {
echo "<script type='text/javascript'>
jQuery(document).ready(function(){
jQuery('#post').attr('enctype','multipart/form-data');
});
</script>";
}
add_action('admin_head', 'add_post_enctype');
}
If you want to test for a particular admin page for example “add page” or “edit-page” here is a slightly improved version of the same script:
if ( is_admin() ) {
$current_admin_page = substr( strrchr( $_SERVER['PHP_SELF'], '/' ),1, -4 );
if ( $current_admin_page == 'page' || $current_admin_page == 'page-new' ) {
function add_post_enctype() {
echo "<script type='text/javascript'>
jQuery(document).ready(function(){
jQuery('#post').attr('enctype','multipart/form-data');
});
</script>";
}
add_action( 'admin_head', 'add_post_enctype' );
}
}
Using this method you can add all sorts of attributes or html to the admin pages when and where needed.