Two problems that are likely related to AJAX

The problems turned out to have something to do with the sortable columns function I wrote before. Please see the function below. function cpt_date_orderby( $query ) { $orderby = $query->get( ‘orderby’ ); if( ‘date’ == $orderby ) { $query->set(‘meta_key’, ‘date’); $query->set(‘orderby’, ‘meta_value_num’); } } add_action( ‘pre_get_posts’, ‘cpt_date_orderby’ ); The problem lies in line 3 where … Read more

Filter media library by custom postmeta

I had to implement the following: Change the admin UI to include my custom filters add_action(‘wp_enqueue_media’, function () { wp_enqueue_script(‘media-library-taxonomy-filter’, get_stylesheet_directory_uri() . ‘/assets/js/custom-media-filter.js’, array(‘media-editor’, ‘media-views’)); }); In the custom-media-filter.js I am appending the custom select HTML and every time my custom select is changed, add the query parameters in the URL and redirect with this … Read more

Can’t load a script in my plugin page

WordPress fires admin_enqueue_scripts hook earlier, than add_options_page, where you put your admin_enqueue_scripts. Solution is simple, you need to put your admin_enqueue_scripts hook outside of the add_options_page function callback. function load_wp_media(){ wp_enqueue_media(); wp_enqueue_script( ‘waterStampScript’, plugin_dir_url( __FILE__ ) . ‘js/app.js’, array(‘jquery’)); } add_action( ‘admin_enqueue_scripts’, ‘load_wp_media’ );

Custom Image Widget

There seems to be no official hooks that effect media widgets. It is possible to access the properties of the widgets in the sidebar using the dynamic_sidebar_params hook in combination the $wp_registered_widgets global widget array. However, there is no image widget property for setting the inline styling of the image. Therefore the simplest solution to … Read more

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