Take excerpt of the content of the post and send it as the title to create new post

I have written a small plugin exactly for that some time ago. It hooks into ‘save_post’ and takes the first 20 characters as title if there is no title set already: add_action( ‘save_post’, ‘t5_fix_empty_title’, 11, 2 ); /** * Fills an empty post title from the first words of the post. * * @param int … Read more

jQuery UI Autocomplete showing all results

You get all terms because you’re asking for all terms, in fact, the line $tradeList = get_terms(‘trade’); just get all the terms, ignoring the ‘term’ query string passed to file. If you want to get all the terms “filterd” you have to use the string in the query, something like: include_once( ‘../../../wp-load.php’ ); // adjust … Read more

jQuery Autocomplete not working with wp_localize_script

If you follow the second approach in the linked Q\A, you do not need ajax, but just to pass the array of terms to the script. First of all in your functions.php (or equivalent) enqueue the script and pass the array of trades via wp_localize_script: add_action( ‘wp_enqueue_scripts’, function() { /* you should check if the … Read more

How would implement StackExchange ‘Questions with similar titles’ for the FAQ on my wordpress site

The communication with the server happens via Ajax. I once wrote a high-level overview of Ajax in WordPress, but you can find many more examples on this site and around the web. Next, you have to do a query that will find similar titles. I found some questions that might help you on Stack Overflow: … Read more

jQuery Autocomplete in WordPress

don’t include WP like that. use $_GET instead: … $(“#tags”).autocomplete(“<?php echo add_query_arg(‘get_my’, ‘terms’, home_url()); ?>”, … theme’s functions.php: add_action(‘template_redirect’, ‘terms_for_autocomplete’); function terms_for_autocomplete(){ if(isset($_GET[‘get_my’]) && $_GET[‘get_my’] == ‘terms’): $terms = &get_terms(get_taxonomies()); foreach ($terms as $term) echo “{$term->name}|{$term->name} ({$term->count} results)\n”; die(); endif; }

ACF Relationship Field Search Filtering [closed]

First, read this post to understand my answer Search that will look in custom field, post title and post content You may want to use the acf/fields/relationship/query/ however, when adding the args: $args[‘meta_query’] = array(array( ‘key’ => ‘your_meta’, ‘value’ => $args[‘s’], ‘compare’ => ‘LIKE’, )); you will find that using that query, WordPress will search … Read more

add_filter the_content str_replace after shortcode

You can change the priority of actions and filters, it’s the third argument of add_filter (and add_action) and it defaults to 10. So change it to a high number and have your filter fire way after the shortcodes and other stuff are inserted. <?php add_filter(‘the_content’, ‘disable_autocomplete’, 99); function disable_autocomplete( $content ) { return str_replace(‘<form’, ‘<form … Read more