New answers tagged

2

First off your setup is quite hard to understand. It seems that the only reason that you are exchanging data from client to server/ JS to PHP is that you have some global info JS object and some gonative_onesignal_info() method. Maybe it's possible to find some PHP SDK or just retrieve that information either synchronously (enter data in input field, perform ...


1

I would divide your question into two parts: Use the query parameters as default for the filter on page load. Update the query parameters dynamically when the form values change. To achieve 1. you'll first need to extract the logic to build $args in property_filters() so it can be used on the initial load: function prepare_property_filters(array $args): ...


0

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 ...


0

To make a working HTTP request with fetch API you have to do something like this. const form = new FormData(); form.append('action', 'make_appointment'); form.append('post_title', 'hola como estas'); const params = new URLSearchParams(form); fetch(ajaxSettings.ajaxurl, { method: 'POST', credentials: 'same-origin', headers: { '...


-1

There may be browser restrictions preventing autoplaying audio, see this answer https://stackoverflow.com/questions/53058421/local-variable-audio-in-object-method-not-playing You can see this in your browser developer tools console, there will be error like this NotAllowedError: The play method is not allowed by the user agent or the platform in the current ...


0

For logged in users, use: wp_ajax_{$action} For logged out users, use: wp_ajax_nopriv_{$action} Your code is currently using wp_ajax_{$action} -> wp_ajax_nizam_handler which will restrict the request to logged in (authenticated users). If you are logged out at the time of the request, you will never make it into your callback. If you want to target ...


0

This fixed my issue $set = stripslashes($set);


0

Yeah, so: First: you should not use query_posts. No, not even if you need ajax pagination. However, this is not your current problem. To be able to sort the "price on request" Properties to the end of the list regardless of the price-sorting, you simply need to save the "price on request" information in another meta field. The reason you need to do this is ...


0

I finally found some helpful information in this post: How to "Load More" posts via AJAX? The issue ended up being a combination of counting the number of total pages of posts, and sharing that number with the hooked ajax function in functions.php. Here's my page template loop: <div class="events"> <?php $socal_cats = array( '...


0

Anwer is yes it does limit. This server parameter max_input_var sets it. You may have to increase it make it work. php documentation : max_input_var : How many input variables may be accepted (limit is applied to $_GET, $_POST and $_COOKIE superglobal separately). Use of this directive mitigates the possibility of denial of service attacks which use hash ...


0

I updated your code there is 2-3 mistake in js file datatype and function file query parameter. Below I paste an updated code, please check and let me know incase of any doubts. Your album-page.php <?php $args = array( 'post_type' => 'albums',//Custom Post type name 'posts_per_page' => 10, ); $query = new WP_Query($args); $tax = '...


1

You might try conditional classes instead. In your regular "style.css" file you would include both classes: .theme-header-title.green { color:green; } .theme-header-title.blue { color:blue; } (Tip 1: avoid !important, just use a more specific style if needed - for example, h1.theme-header-title.green.) Then in your HTML, which is likely in your "header....


0

Your action should be wp_ajax and wp_ajax_nopriv instead of admin_ajax. add_action( 'wp_ajax_new_message', array($this, 'process_upload') ); add_action( 'wp_ajax_nopriv_new_message',array($this, 'process_upload') );


0

You can use "mid_size" to manage number of pages to display in paginate_links() function. Please check https://developer.wordpress.org/reference/functions/paginate_links/ for pagination options. Please see example below to use mid_size. $args = array( 'mid_size' => 3, 'prev_next' => true, 'prev_text' => '« Previous', 'next_text' ...


0

try with Axios instead jQuery and check the response, example let form_data = new FormData; form_data.append('action', 'myAction'); form_data.append('first_name', 'my first name'); axios.post(myVars.ajax_url, form_data).then(function(response){ console.log('response', response.data); }).cath(console.log)


1

If you have a form you should have a sort field in it, so that you can send your order value on form submit. This way you can send the sorting parameter to your backend callback function. If you don't have a form you shoud add this parameter to another element with a data attribute like that: <button id="load-more" data-order="DESC">Load More</...


0

You can use default wordpress function to search categories. get_terms() is the function you need to use where you need to pass your search string in a search parameter. For details please check get_terms function in wordpress codex


0

In your jQuery you have jQuery('.post-tags select').on('change', function(event) { but when I look at the source code of your page the dropdown is <select id="dropdown_select" class="dropdown_options">, I don't think your script is watching the correct item. Try correcting that in conjunction with the other answer and see if that has an effect.


0

You can upload file using ajax using below code: First : Add attributes name="f-form" and id="f-form" in your <form> tag. After that, In js script, get form data using new FormData() and send to ajax data, Note : change url: ajax_object.ajaxurl with your ajax url path jQuery(document).ready(function(e) { jQuery('#f-submit').on('click', ...


2

Currently you can not unset key because you can not find proper key from array. The issue is that you did $stamp = array($_POST['stamp']); as array which is wrong. you have to remove array() from $stamp, so which look like $stamp = $_POST['stamp'];. then you can search value in column from array and unset it. I have tested below code which is working ...


Top 50 recent answers are included