Tag Info

Hot answers tagged

4

I have observed the same issue with contact-form-7 a while back. But note that registering shortcodes based on is_admin is doing_it_wrong (see gmazzap`s answer) There are the two reasons that seem legitimate at first sight (and why they are wrong): (Unlikely) The plugin author tried to optimize the script to only register shortcodes when they are needed. ...


2

Actually, there is no reason to do not register shortcodes on admin. If plugins author want to disable plugin form Ajax they should do if (defined('DOING_AJAX') && DOING_AJAX) instead of checking for is admin. Note that in future, is possible that Shortcake will be embedded in core because it is a "Feature Plugin". If it will happen, shortcode ...


2

When you send an AJAX request, wp-admin/admin-ajax.php is called, not your template file. This separate request has no knowledge of all existing code in all existing templates, because they aren’t even included. What is included: the theme’s functions.php and plugin files. This is why your callback works in a plugin. As a rule of thumb: templates should ...


2

There is always a timeout, be it TCP or the PHP execution time ( unless you configure your server in a weird way, PHP will kill long running tasks ). If you need to do a lot of work you should: Break it into smaller pieces Plugins like regen thumbnails retrieve a list of items to do work on, then go through the list in small fast batches keeping track of ...


2

OK, I found out that my DB encoding was LATIN2 and wordpress forced UTF-8 in all calls after the update. When I changed my database's encoding to UTF-8 it all started to work. I also used: $comment = mb_convert_encoding($comment, "UTF-8"); just to be shure.


1

The main issue I was having is that when an ajax request hits not all hooks are being loaded. I used this code: $return = array(); foreach( $GLOBALS['wp_actions'] as $action => $count ) { $return["message"] .= $action . ", "; } wp_send_json($return); This showed me the hooks that were running before and I got it to work. I think removing ajax ...


1

I am not sure the output you have provided is the correct one but do you notice the '0' character at the end of your string? ...



Only top voted, non community-wiki answers of a minimum length are eligible