Make a custom column sortable by a value from a different custom post type

(I was going to add this as a comment as it’s not a full answer, but I can’t yet…) I think you will need to use an SQL query as the standard meta_queries / orderby won’t work. Have a look at Custom Table Column Sortable by Taxonomy Query and http://wpdreamer.com/2014/04/how-to-make-your-wordpress-admin-columns-sortable/#sorting-posts-option-b for a couple of examples.

How can I edit comment meta value before it is saved?

You can use “save_post” action-hook Add the code below into functions.php and enchance with your comment_meta code. function update_comments_meta( $post_id ) { // Do whatever add/update_comment_meta code you need } add_action( ‘save_post’, ‘update_comments_meta’ ); UPDATE. As an example i’ve attach code below. It performs on post save/update action fired. Code gets current post comments (all) … Read more

Action hook with wrapper html

You want the has_action() function. add_action( ‘category_promo_header’, function () { echo ‘hi there’; } ); if (has_action(‘category_promo_header’)) { echo ‘<div>’; do_action(‘category_promo_header’); echo ‘</div>’; } Comment that add_action and you should see that nothing is printed at all.

Block Update Profile Errors

Solution: First, Jeff Farthing of theme-my-login pointed out that I was using add_filter instead of add_action, and helped to craft the first code below, however it still has the same problem, so this is a step in the right direction but is not my solution: function tml_profile_errors( &$errors ) { if ( empty( $_POST[‘state’] ) … Read more

Can an RSS item be altered with a hook?

the_content_feed is the hook I needed. In my case I am running a regex to replace relative URLs to absolute ones, so I added the following code to functions.php add_action(‘the_content_feed’, ‘relative_to_absolute_links’); function relative_to_absolute_links($content) { return preg_replace(“/(src=[‘\”]){1}\/{1}([^\/][^’\”]+)([‘\”])/im”, “$1” . get_site_url() . “/$2$3”, $content); }

Woocommerce single_product_summary hook not working

In your first code block try changing return $output; with echo $output; and that should work provided $output is not empty 🙂 If you are trying to append your custom field to the product summary, this can be very well achieved using woocommerce_short_description filter hook. Please see below code: function add_subtitle_to_product() { global $post; if … Read more

WP Cron not executing after timespan

Your custom hook is never triggered because you are not subscribing to it the right way! Context Although you are calling it in your class function, it is never executed beyond that point. Place the add_action function somewhere else like in a plugins_loaded hook. Put it outside your class where it can be seen. Dependencies … Read more