How to make post and comment count unclickable with dashboard_glance_items hook

The dashboard_glance_items filter is only useful for modifying the extra elements. The posts/comments data elements have already been displayed. Here are three ideas: Method #1 – Use the dashboard_glance_items filter: You can use the following filter setup, to remove the posts/pages/comments elements from the output of wp_dashboard_right_now(). The trick is simple, foul WordPress to think … Read more

Overriding wp_get_archives() apply_filters()

A WordPress filter is a function that takes in a string, array, or object, does something to it, and returns that filtered string, array, or object. So what you want to do is turn “WHERE post_type=”post” AND post_status=”publish”” into “WHERE post_type=”post” OR post_type=”events” AND post_status=”publish””. That is fairly straightforward. From the looks of things, the … Read more

apply_filters(‘the_content’, $content) alternative

The Core filters on the_content are: 131 add_filter( ‘the_content’, ‘wptexturize’ ); 132 add_filter( ‘the_content’, ‘convert_smilies’ ); 133 add_filter( ‘the_content’, ‘convert_chars’ ); 134 add_filter( ‘the_content’, ‘wpautop’ ); 135 add_filter( ‘the_content’, ‘shortcode_unautop’ ); 136 add_filter( ‘the_content’, ‘prepend_attachment’ ); You can apply whichever of those you’d like to any string you’d like. The second parameter is the name … Read more

Disable resizing of gif when uploaded

image_make_intermediate_size was not the hook I was looking for, but intermediate_image_sizes_advanced. Here is a working code: function disable_upload_sizes( $sizes, $metadata ) { // Get filetype data. $filetype = wp_check_filetype($metadata[‘file’]); // Check if is gif. if($filetype[‘type’] == ‘image/gif’) { // Unset sizes if file is gif. $sizes = array(); } // Return sizes you want to … Read more

apply_filters() slices away needed arguments

Two inherent problems with your script as posted. I’m not certain this will solve your problem, but it’s too big to address in the comments. First, you need to use add_action(), not add_filter(). That by itself is not a huge deal because add_action() is just a wrapper for add_filter(), but you should still use the … Read more

How can I send data to admin-ajax via JS Fetch?

Is it proper way to pass the data in the form like I did? If you mean the body part (of your fetch() call), then yes, it is okay. However, You must send a query named action as part of the request (e.g. via the URL like example.com/wp-admin/admin-ajax.php?action=test), so that WordPress knows what AJAX action … Read more