Home > Software design >  Problem with the media library in wordpress
Problem with the media library in wordpress

Time:05-09

I am building my own wordpress theme and I have such a problem. Media library doesn't work, I can't add any image to the page. I am using the latest version of wordpress. Files available on github https://github.com/krysba/themes-wordpress When I turn on the standard wordpress theme, the library works :( I am asking for help in solving this problem.

CodePudding user response:

If you have not tried, the first thing that i'll tring it's enable debug mode on Wordpress from wp-config.php and check if some alerts or errors can help.

define('WP_DEBUG', true);

CodePudding user response:

Thanks, I have debugging turned on, but it doesn't show an error

define( 'WP_DEBUG', true );
define( 'WP_DEBUG _LOG', true);
define( 'WP_DEBUG_DISPLAY', true);

CodePudding user response:

I think that you must try to comment all function.php and debugging it row by row. At the first check i've found a wrong use of the function add_theme_support and in the enqeueing files.

For example the right way to user add_theme_support is on the after_setup_theme action:

function my_setup_theme(){
   add_theme_support('post-formats',array('gallery','link','image','quote','status','video','audio'));
}
add_action( 'after_setup_theme', 'my_setup_theme' );

Also the right way to enqueing scripts or styles is that:

function add_theme_scripts() {
  wp_enqueue_style( 'style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'add_theme_scripts' );

See it on this page: https://developer.wordpress.org/themes/basics/including-css-javascript/

  • Related