get_current_screen – ‘Trying to get property of non-object’ error

I tested this code and it worked fine. Where are you requireing screen.php? Same way as this? require_once(ABSPATH . ‘wp-admin/includes/screen.php’); add_action( ‘parse_query’, ‘filtering_edit_table’ ); function filtering_edit_table( $query ) { $screen = get_current_screen(); if( is_admin() && $screen->post_type == ‘custom_post_type’ && $screen->base == ‘edit’ ) { print_r($screen); } }

admin_url() do not retrieve the correct url in an subdirectory install

I solved my problem by trying this (and it works!): function get_some_url() { $full_url = add_query_arg( ‘action’, ‘action-name’, admin_url( ‘users.php’ ) ); //$relative_url = str_replace( get_site_url(), ”, $full_url ); //return $relative_url; return $full_url; } This was tested in a localhost/subdirectory install and in a live install (not subdirectory). Now the URL is retrieved correctly.

WordPress User profile page fields missing

This is the new default password methodology used in WordPress 4.3. In WordPress 4.3, if you have Javascript disabled or broken, then you will get the normal New Password and Repeat New Password fields. If you have Javascript enabled and running normally, then you only get the Generate Password button. If you get two things … Read more

Hook into backbone to add js to wp-admin -> media library?

You can enqueue javascript files and css files like this for wp admin:- function load_custom_wp_admin_style() { wp_enqueue_script( ‘script-name’,’js/scripts.js’, array(‘jquery’), ‘3.3.5’, true ); } add_action( ‘admin_enqueue_scripts’, ‘load_custom_wp_admin_style’ ); First you need to enqueue admin scripts like below:- function my_admin_scripts() { wp_enqueue_script(‘media-upload’); wp_enqueue_script(‘thickbox’); } function my_admin_styles() { wp_enqueue_style(‘thickbox’); } for uploading attachment:- $(‘.upload_image_button’).live(‘click’,function() { formfield = $(‘#upload_image’).attr(‘name’); … Read more

I cannot access my WP website after changing settings

To get your site back Open wp-config.php – ( add these lines ) define(‘WP_HOME’,’www.therealdeal.org.uk/newsite’); define(‘WP_SITEURL’,’www.therealdeal.org.uk/newsite’); or to have it autmatically map to the right places define( ‘WP_SITEURL’, ‘http://’ . $_SERVER[‘SERVER_NAME’] ); define( ‘WP_HOME’, ‘http://’ . $_SERVER[‘HTTP_HOST’] ); Load the admin or login pages a few times

Making changes to woocommerce order before save

A popular method is to hook to the order status. You have several status names to choose from: completed processing cancelled on-hold You would use it like this: add_action(‘woocommerce_order_status_processing’ In addition you can intercept a certain change like this: add_action(‘woocommerce_order_status_on-hold_to_completed’ Finally you can intercept any change that takes place like this: add_action(‘woocommerce_order_status_changed’

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