Using AJAX to load div doesn’t always work

changue this: <script type=”text/javascript”> $(“.mystory-link”).click(function(){ // Your code; return false; }); </script> BY (This is the correct way to use jquery events): <html> <body> <!– anchors –> <a class=”mystory-link” href=”https://www.google.com”></a> <a class=”mystory-link” href=”https://www.yahoo.es”></a> <a class=”mystory-link” href=”https://www.youtube.com”></a> <!– content –> <div id=”mystory-container”></div> <!– javascript –> <script type=”text/javascript”> $(document).on(‘ready’, function(event) { // this method select all Class … Read more

Same query in category.php and in function.php, but different result

Found the answer – the query on the category page had post_status=”publish” by default and the query in the function.php had post_status=”publish” OR post_status=”future” OR post_status=”draft” OR post_status=”pending” as default, so the solution was to be more explicit in the $args and add ‘post_status’ => ‘publish’.

AJAX Filter WHILE Loop not working WordPress

I think you should organize your code to return things from Ajax call. If this should work for any user you need to use also wp_ajax_nopriv_… However, I would use dionoh_filter_reports action name. add_action( ‘wp_ajax_dionoh_filter_reports’, ‘filter_reports’ ); add_action( ‘wp_ajax_nopriv_dionoh_filter_reports’, ‘filter_reports’ ); I suggest you check this and learn more.

wordpress function through ajax not being called

Based on your comments, I don’t think the MyAjax variable is being localized using wp_localize_script(). In your case, you’ll most likely need something like the following: wp_localize_script( ‘script’, ‘MyAjax’, array( ‘ajaxurl’ => admin_url( ‘admin-ajax.php’ ), ) ); That said, I don’t really have enough information to provide a more detailed answer. EDIT: This and the … Read more

Display SOLDOUT text in Dropdowns of Variable Product in WooCommerce [closed]

Step 1: Add below code to variable.php file located in woocommerce plugin (single-product/add-to-cart) <?php $product_variations = $product->get_available_variations(); echo ‘<ul class=”attr_avail_custom dnone”>’; foreach ($product_variations as $variation) { $var_data = $variation[‘attributes’]; if(!$variation[‘is_in_stock’]) { echo ‘<li>’; foreach ($var_data as $vk => $vv) { echo “<span data-key=$vk data-value=$vv >$vv</span>”; } echo ‘</li>’; } } echo ‘</ul>’; ?> Step 2: … Read more

How to block search engines indexing certain AJAX actions

If an ajax call is indexed it compromises the whole purpose of the application. The cause here is that you are making your call using GET instead of POST as suggested: https://codex.wordpress.org/AJAX_in_Plugins The right way should be along something like : <?php add_action( ‘admin_footer’, ‘my_SHOP_javascript’ ); // Write our JS below here function my_SHOP_javascript() { … Read more

Ajax Response Error

Double comment blocks makes me the same problem: /* … */ */ Try to remove all commented blocks from your functions.php or included sub-functions. Clean your functions.php and add one by one function and you will find the issue. Third thing was PHP passing by reference, try to avoid it.