get USER ID in functions.php using user_register action

You are giving $wpdb->get_results a string for its second parameter. It should be a constant– ARRAY_N— meaning you need to remove the quotes $getunion = $wpdb->get_results( “SELECT value from wp_bp_xprofile_data where user_id = $getid AND field_id = 4”, ARRAY_N ); Since you claim it works in the second instance, I am assuming $wpdb compensates, but … Read more

Function in functions.php by url

You can check for the presence of a specific query variable, so http://www.example.com?my_listener=test. You check for this on the init hook and if it isn’t there you just quit early and WP goes about it’s business. If it is there, you can then do something, just don’t forget to exit at the end or the … Read more

How to add a class and title attribute to the link generated by next/previous post

previous_post and next_post are deprecated. you should be using previous_post_link and next_post_link. That function applies the {$adjacent}_post_link filter. You can use that to get what you want. A very, very crude example: function construct_np_attr_wpse_92086($matches) { if (‘prev’ == $matches[1]) { $np = ‘Previous’; } else { $np = ‘Next’; } $ret=”rel=””.$matches[1].'” class=”normalTip” ‘; if (!empty($np)) … Read more

Using Output from one Function and calling it into another

This isn’t really a WordPress question… that said $recClasses = pa_insertPage($output); is incorrect. here you should be passing to insertPage whatever the arguments are. Then insertPage will return $output, making $recClasses the same value as $output. $recClasses = pa_insertPage(‘your attributes’); // $recClasses now equals $output;

Search Woocommerce product titles only

It turns out the free Relevanssi plugin does this rather well. I was afraid it would only search posts and not custom post types, but it does it all… and rather well! It only requires a simple filter added to your theme’s functions.php file to get it to omit the body content: // search titles … Read more