How to isolate code to the post edit screen

Use the WP_Screen object to tell where you are at in the admin instead. Much more convenient. $screen = get_current_screen(); if ( $screen->id == ‘edit-post’ ) { // you’re on the posts screen } Note that you have to wait until at least the admin_head hook to run for the current screen to have been … Read more

wp_dequeue_script not working in my plugin

wp_enqueue_script() also registers the script. So, you’ll also need to de-register it first. This code should work depending on how and where the script is enqueued. function my_dequeue() { wp_deregister_script( ‘ocmx-jquery’ ); wp_dequeue_script( ‘ocmx-jquery’ ); } add_action( ‘admin_enqueue_scripts’, ‘my_dequeue’, 10 ); You might also need to play with the priority of the action.

How to enqueue jquery in admin and why is it not already there?

First, check for syntax errors. The syntax highlighting seems to indicate that you have syntax errors. Second, don’t wrap your add_action() calls inside conditionals; rather, wrap your callback function content inside the conditionals, e.g.: <?php function theme_upgrade_alernt() { if ( is_admin() && $pagenow == ‘theme-install.php’ && $_GET[‘tab’]==”upload”){ // CODE GOES HERE } else { // … Read more

Register jQuery – OOP WP

You are setting your script to be added at the wp_head action. jQuery, along with most other scripts, are loaded as part of the wp_enqueue_scripts action. Care to guess which of those comes first? 😉 Edit This is actually not true. jQuery is loaded as part of wp_default_scripts which does take place before wp_head I … Read more

Why Won’t my jQuery Play Nice with WordPress?

WordPress automatically loads jQuery in “no conflict” mode so that it will be compatible with other libraries. This means the $ variable isn’t used for jQuery within WordPress. Rewrite your code to use the full jQuery keyword when you begin your closure like this: jQuery(document).ready(function($) { // … other code in here }); This is … Read more

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