How do I get reusable blocks via frontend REST API?

How do I get reusable blocks via frontend REST API? We need to be logged in as a user and additionally add the wp_rest nonce to the block rest endpoint request, either via the _wpnonce POST/GET parameter or via the X-WP-Nonce header. See e.g. the docs for more information on the authentication. EDIT: As pointed … Read more

splitting the URL using jQuery

Not really a WordPress related question but you could do this // creates a object from the array, one of the properies (search) contains the query let url = new URL(‘https://dev/job/?job_id=jkdbsbd45JubJKAAASSYT’); // will create a object of all availalble query properites const urlSearchParams = new URLSearchParams(url.search); const params = Object.fromEntries(urlSearchParams.entries()); // remove ? and everything … Read more

Update get_pages using ajax on form select change

Your Javascript is loading the whole page anyway, since you are sending a request to the_permalink. If you are going to do that just reload the page. First, your should be using the AJAX API. There are a couple of steps but it isn’t that hard. See the Codex to get started. In your callback … Read more

Ajax loading duplicate post

You have got a few things to consider here. Let’s start the way the Browser does. You build up the HTML, so far so good, containing the Structure and everything for your site. No articles are shown. The next step your Browser has to do is make the AJAX call. Here are the first things … Read more

admin-ajax.php ” Missing argument 2″ warning

Ajax-calls use the $_POST-variable to submit their arguments to the function. As $_POST[‘action’] is always used by WordPress Ajax calls (contains the name of the action, obviously 😉 ), PHP only complains over missing argument no. 2. You can either use the solution provided by Bainternet. If you want to use your function in ajax … Read more