“Unexpected error” on update requests

Navigating WP admin in general tends to trigger multiple external requests, such as fetching news feeds and theme/plugin updates (not counting whatever plugin/themes might be doing on their own). You can put configuration constants into wp-config.php to block external requests completely/partially: define( ‘WP_HTTP_BLOCK_EXTERNAL’, true ); define( ‘WP_ACCESSIBLE_HOSTS’, ‘api.wordpress.org,*.github.com’ ); Or configure external requests to use … Read more

How do I add support to my theme for custom menus?

The easiest way is to use the register_nav_menus function.This should be hooked into ‘after_setup_theme’: function my_cool_menu_function(){ register_nav_menus( array( ‘primary’ => ‘Primary Navigation’ )); } add_action( ‘after_setup_theme’, ‘my_cool_menu_function’ ); Then, in your theme, simply call that menu’s position: wp_nav_menu( array( ‘theme_location’ => ‘primary’ ) );

how to override woocommerce specific loop or archive-product.php [closed]

The WooCommerce templating works in different ways depending on your needs and/or skills. The function: <?php wc_get_template_part(‘content’, ‘product’); is the WooCommerce equivalent of WordPress core template function: <?php get_template_part(‘filename’); It is important to know that this is the same as php require but without using .php extension at the end. Before you do any of … Read more

No “Add New” Button. How to add new theme?

In my case, the button was missing because it was a multisite install. The Add New button appears only when you go to top bar -> My Sites -> Network Admin -> Themes. From there, you can add new themes and enable them for the rest of the network.

Dash or underscore in theme folder name?

In short, there is no well defined convention for naming a theme’s directory, and all of the following are valid (among others): my_wordpress_theme my-wordpress-theme (empirically the most popular option within the ecosystem) MyWordPressTheme mywordpresstheme (what the default themes use) Details The WordPress PHP Coding Standards Handbook states that filenames should be all lowercase and hyphen-separated. … Read more

My child theme doesn’t work Error: “The parent theme is missing. Please install your parent theme”

There are three things to check: Is your parent theme complete and what is the exact spelling of the parent theme’s name in its style.css. Uppercase and lowercase are important. Is the child theme directory named parentname-child. It should be in the themes directory, not in a subdirectory of the parent theme. Does the child … Read more

Should `get_template_directory_uri()` be escaped?

In that function we find a hook: return apply_filters( ‘template_directory_uri’, $template_dir_uri, $template, $theme_root_uri ); So, yes, the URI can be changed by plugins, and you should escape its returned value. The same principle applies to all WordPress URI functions, like get_home_url(), get_site_url() and so on. Keep in mind that there are not only good plugin … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)