How can I use wp_insert_comment to write a comment when a post is edited?

Try using the following code in the functions.php file of your child theme theme. function add_comment_on_post_update( $post_id, $post_after, $post_before ) { // If this is just a revision, don’t send the email. if ( wp_is_post_revision( $post_id ) ) return; if (defined(‘DOING_AUTOSAVE’) && DOING_AUTOSAVE) return; if (isset($post_before->post_status) && ‘auto-draft’ == $post_before->post_status) { return; } if (‘post’ … Read more

Run a filter when a walker runs

If all of it is your own code then it would be reasonable to just implement that as part of walker. If you need to add a filter while third party walker runs you could probably: Add it at wp_nav_menu_args hook, checking if walker is set to that: add_filter( ‘wp_nav_menu_args’, function( $args ) { if … Read more

How to get media objects

Have you tried to use get_children() function? Edit: All media attached to any post is treated as children of it. The function wp_get_attachment_image() will only return images. With the function get_children() you’ll be able to get all the media, images or anything else. In the above link, you can find some examples.

How to show only a certain part of the entry title?

Hiding part of the title with CSS clipping (as the OP requested in the original unedited title) is almost certainly not the best way to accomplish this. Here is how to do this in the template file. If all of your titles will be formatted the same way (with a space, a hyphen, and a … Read more

Auto delete WordPress users according to time

You can include this code by creating a new custom plugin which help you to stop this when you deactivate the plugin. wp_schedule_event(time(), ‘daily’, ‘my_dailyClearOut’); function my_clearOldUsers() { global $wpdb; $query = $wpdb->prepare(“SELECT ID FROM $wpdb->users WHERE datediff(now(), user_registered) > 7”); if ($oldUsers = $wpdb->get_results($query, ARRAY_N)) { foreach ($oldUsers as $user_id) { wp_delete_user($user_id[0]); } } … Read more

Using shipped version of jquery

The jQuery library packed with WordPress, operates under noConflict mode. Means you can not use $ in your jQuery snippet/code. Either use jQuery instead of $. or use noConflict wrapper like this. <script type=”text/javascript”> <!– jQuery(document).ready(function($) { // your jquery function, you can use $ here. }); // –> </script>

How Can I Call Up The Author’s Name on a Post

Inside The Loop you can use the Template Tag the_author() to display or get_the_author() to return the same. For an introduction to outside the loop usage take a look at the Q&A’s at the thread How to get Author ID outside the loop on here.