Set default options for inserting media

You can do this in two ways. If you want to keep it theme specific, edit your functions.php file with this code: add_action( ‘after_setup_theme’, ‘my_new_default_image_settings’ ); function my_new_default_image_settings() { update_option( ‘image_default_align’, ‘right’ ); update_option( ‘image_default_link_type’, ‘file’ ); } The other way to do it is more general, but also more rigid: Go to YOURSITE.COM/wp-admin/options.php Find … Read more

Good tools for locating hooks in a wordpress page/admin interface/blog post?

It is usually easy to find most hooks in documentation or source. It can be much more tricky for hooks that are dynamically generated, like post transitions. Essentially it doesn’t exist in source as specific hook – it is hook that is getting generated dynamically at runtime, depending on variables. do_action(“${old_status}_to_$new_status”, $post); do_action(“${new_status}_$post->post_type”, $post->ID, $post); … Read more

Alter image output in content

Your better off adding your custom image data when you insert it into a post using media_send_to_editor, the caveat is this will not be applied to any existing images, only ones inserted after adding the function. To apply it to to existing content you will have use preg_match on the_content filter, but this can significantly … Read more

How do I “unhook” / de-register jQuery so that it’s not called as part of wp_footer();?

You don’t want to unregister the script; that would make it unavailable to be enqueued. Rather, you want to dequeue the script. You have two choices: If you know the callback function through which wp_enqueue_script( ‘jquery’ ) is called, you can simply call remove_action( ‘wp_footer’, ‘callback_function_name’ ) More likely, you won’t know the callback function … Read more

How to enable visual editor when editing comments on the dashboard?

If you are using WordPress 4.0+ you can do this using the wp_editor_settings and the global $pagenow to determine if you are on the comments page. add_filter( ‘wp_editor_settings’, ‘remove_editor_quicktags’, 10, 2 ); function remove_editor_quicktags( $settings, $id ){ global $pagenow; if ( $id == ‘content’ && $pagenow === ‘comment.php’ ){ $settings[‘quicktags’] = false; $settings[‘tinymce’] = true; … Read more

How to get the password and username of the add new user form (admin back end) in wordpress

You’ll need three hooks: 1: user_register This is for when the user is created via the admin back-end. The username will be available via $_POST[‘user_login’] and the password will be available via $_POST[‘pass1’]. 2: edit_user_profile_update This is for when the password is updated on the profile page by the user or admin. The username will … Read more

what is the action hook code to supporting product category condition in single product page of woocommerce?

Firstly, this conditional returns true on category archives for Woo Commerce and NOT single product page. Try using the actual slug in lowercase or the i.d. Example: if ( is_product_category( ‘t-shirt’ ) ) { Your code looks like its wrong because it includes too many brackets. Woo suggest using the slug in their Docs. This … Read more

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