Ajax call to my WordPress website from an external application [duplicate]

You shouldn’t be sending your data as JSON: dataType: “JSON” For add_action(“wp_ajax_nopriv_itempricingfunction” to work, WordPress needs to find the action parameter in your request, which you’re correctly setting here: data: { action : “itempricingfunction”, ean : “EANTEST0101010” }, The problem is that it checks this using $_REQUEST[‘action’], but PHP doesn’t populate $_REQUEST with JSON. It … Read more

How to check for WordPress timezone type?

If we want to work with php’s datetime features and timezone objects AND handle sites that use a gmt_offset, sadly it does require some trickery. I have not found a better way to do it than this: Check for timezone string first – got one – great! Else Check for gmt offset, then try to … Read more

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

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