post value to function with Ajax and jQuery

The error is quite self-explanatory. Your last lines are: add_action( ‘wp_ajax_my_action’, ‘my_action_callback’ ); add_filter( ‘wpforms_smart_tag_process’, ‘my_action_callback’, 10, 2 ); The action is calling the same function as the filter. But the filter passes two variables and the action only one. The function itself expects two variables: function my_action_callback($content, $tag) So if you call the function … Read more

Delete oldest wordpress post (SQL query)

I figured it out! Pretty simple actually.. You can replace post_date_gmt with ID depending on your needs. post_author != 1 will prevent the admin’s post from being deleted, so the menu links and pages will stay intact 🙂 function deleteOldestPost(){ global $wpdb; $prefix = $wpdb->prefix; $wpdb->query(“DELETE FROM “.$prefix.”posts where post_author != 1 order by post_date_gmt … Read more

Remove text after a dot and a colon in Woocommerce product title

Try using following code: add_filter(‘the_title’, ‘mod_product__title’, 10, 2); function mod_product__title($title, $id) { if( is_product() ) { if(preg_match(‘/[^(:|.)]*/’, $title, $matches)){ return trim($matches[0]); }else{ return $title; } } return $title; } Here I’m using regex to match . or : . Regex will match only the first occurrence and return the text before it. Then I’m using … Read more

Creating a custom functions page wordpress

I don’t think WordPress knows to load or run anything from your registerProcess.php file, so what I would do is leave the register_user() function in that file, and then require_once it from functions.php and do the active part of the code – the if .. register_user() inside functions.php where it will be run. (This is … Read more