List authors with posts in a category

This can become a quite an expensive operation which can seriously damage page load time. At this stage, your code is quite expensive. Lets look a better way to tackle this issue. What we need to do is to minimize the time spend in db, and to do this, we will only get the info … Read more

WordPress PHP plugin – Settings page error

Your form is not including any additional parameters. $_SERVER[‘PHP_SELF’] is only the file name, not the ?page=job-board/adduser.php part. The script is going precisely where you are telling it to go. You need to alter your form to push those values though. You need to include that GET component into the action attribute. But give your … Read more

Loading wordpress stuff on laravel site

You are trying to do that just to output a WP menu on a Lavarel site? In this case you are loading all WordPress environment (themes, plugins, options…) just for a menu. This not seems to me a great thing. Probably, the most elegant approach for this, should be in Laravel create the eloquent models … Read more

How to block specific keywords from searching on WordPress?

You are looking for pre_get_posts. This action is run between the composition of a (search) query and the actual query, to allow you to change the query. So, it would allow you to intercept banned keywords like this: add_action( ‘pre_get_posts’, ‘wpse338558_intercept_banned_keywords’ ); function wpse338558_intercept_banned_keywords ($query) { $banned = array (‘word1′,’word2′,’word3’); if (in_array ($query->query_vars[‘s’], $banned)) $query->s=””; … Read more

wp enqueue style and style sheet depth

You can add a priority number to the wp_enqueue_scripts action. So you could could give the action hooked to the enqueue of yourstyle sheet a priority of 999. Like so: function high_priority_style() { Wp_enqueue_style(‘important’, get_template_directory_uri() . ‘/css/important.css’); } add_action(‘wp_enqueue_scripts’, ‘high_priority_style’, ‘999’); A simpler way to do is enqueue all of your stylesheets, including style.css in … Read more

Is Auto Post recognition a WordPress feature? How to turn it off?

This is done by redirect_guess_404_permalink(), which is called from redirect_canonical(). redirect_canonical() does more than just this: it makes sure you are always using a single canonical URL for an item, it will add slashes, force the same domain name, … You can either unhook redirect_canoncial so it does nothing, or you can hook into it … Read more

Customizer Show/Hide Logo and Site Title

Try this function, why going through js when you can just do it with php inside your same file customizer.php /* ** show site title or hide it */ function showtitle_slogan() { $showttlslogan = get_theme_mod(‘display_site_title’); if ($showttlslogan == true) { ?> <style type=”text/css”> .site-title { display:none;} </style> <?php } } add_action(‘wp_head’, ‘showtitle_slogan’); And do the … Read more