Articles of deprecation

wp_get_http has been deprecated. Use WP_Http instead

I use a premium plugin (for theme dev.) that has included the WordPress Importer plugin and I get a deprecated notice: “wp_get_http has been deprecated. Use WP_Http instead” But the WP_Http send me to this function. The question is how to use wp_http_supports in the following code instead of wp_get_http: function fetch_remote_file( $url, $post ) […]

Deprecated function get_user_by_email($email)

I tried to find replacement function for get_user_by_email($email) but no luck. This function I am using to allow user to log in by email address or user id. Is there any replacement function or alternate way to do that?

wp_create_category deprecated?

Was trying to use this today: WP Create Category https://codex.wordpress.org/Function_Reference/wp_create_category Trying that (which I also assume it’s only going to add terms to the built in “Categories” taxonomy) throws this error: Fatal error: Call to undefined function wp_create_category() in /yourwebsite/wp-content/themes/fitt/functions.php on line 123 Though I do see it in /wp-admin/includes/taxonomy.php on line 45: /** * […]

wp_get_theme Warning: Illegal offset type

I’m using Post templates plugin. But its very outdated. I’m getting Warning: Illegal offset type at this line $templates = $themes[$theme][‘Template Files’]; Here is my full function code. function get_post_templates() { $themes = wp_get_themes(); $theme = wp_get_theme(); $templates = $themes[$theme][‘Template Files’]; $post_templates = array(); $base = array(trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory())); foreach ((array)$templates as $template) { $template = […]

Is it safe to update from 2.6.2 to the newest version?

I’m using WordPress version 2.6.2 and now it shows in the page that Deprecated: Assigning the return value of new by reference is deprecated in /home/np14388/domains/<sitename>/public_html/wp-settings.php on line 472 etc. Is it safe to update from this version to the newest one, or should I update in certain phases (2.6.2 -> 2.6.3 etc.)? Please help.

Pass parameter to hooked function using custom page template

Based upon this I have tried to write the following code as: Custom Page template: /* Template Name: product_filter */ get_header(); do_action( ‘pre_get_posts’, ‘COOLING’); Functions.php add_action(‘pre_get_posts’,’shop_filter_cat’,10,1); function shop_filter_cat($query, $arg) { if (!is_admin() && is_post_type_archive( ‘product’ ) && $query->is_main_query()) { $query->set(‘tax_query’, array( array (‘taxonomy’ => ‘product_cat’, ‘field’ => ‘slug’, ‘terms’ => $arg ) ) ); } […]

Display only author posts in dashboard all posts panel

I would like to display only authors own posts in dashboard all posts section. As of now it displays everything. I found some code here which is written by @t31os Its working correctly. function posts_for_current_author($query) { global $user_level; if($query->is_admin && $user_level < 5) { global $user_ID; $query->set(‘author’, $user_ID); unset($user_ID); } unset($user_level); return $query; } add_filter(‘pre_get_posts’, […]

wp_customize_image_control deprecated add_tab alternative

I have been using add_tab to add a tab in Customizer with default images. It is deprecated and no longer works in WordPress 4.1. How can I create/find an alternative? add_action( ‘customize_register’,’add_pattern_images’, 12, 1 ); function add_pattern_images( $wp_customize ) { $control = $wp_customize->get_control( ‘aaa[backgroundpattern]’ ); $control->add_tab( ‘theme_patterns’, ‘Theme Patterns’, ‘pattern_images’ ); } function pattern_images() { […]

Deprecated issue in WordPress

I am new in WordPress Development. I updated version of my WordPress site to 4.6.1. Then I found this error in debug.log Notice: The called constructor method for WP_Widget in C_Widget_Gallery is deprecated since version 4.3.0! Use __construct() instead. in /home/spslive/public_html/wp-includes/functions.php on line 3767 I tried to find out C_Widget_Gallery in functions.php. But could not […]

How a deprecated function can crash WordPress site while upgrading

It is said that deprecated functions used in plugins & themes can crash a wordress website while upgrading to newer version, I want to see an example of deprecated function that can cause a crash. Can someone show me an example? Many Thanks!