Load content in a div with ajax

Use Ajax API provided by WordPress. In first time, fix your Ajax request : <script> $(“.post-link”).click(function(){ var post_id = $(this).attr(“rel”); //this is the post id $(“#post-container”).html(“content loading”); $.ajax({ url: myapiurl.ajax_url, type: ‘post|get|put’, data: { action: ‘my_php_function_name’, post_id: post_id }, success: function(data) { // What I have to do… }, fail: { // What I have … Read more

Is 30 posts/sec considered slow for wp_delete_post?

Speed factor of any function that deals with content such as wp_insert_post() or wp_delete_post() highly depends on the situation and the content that it’s dealing with. Let’s make a simple example. You have a post, that contains featured image, dozen of tags, categories, a thousand custom fields, assigned taxonomies, and a hundred more. When you … Read more

Show ‘Read more’ in rss feed

You can, but you shouldn’t. RSS feeds are built in XML. Not in HTML. Links in XML don’t have meaning because they’re HTML elements. However, because XML can be read by most HTML parsers (i.e. web browsers), you can easily mistake an XML document for an HTML one (the prevalence of XHTML helps to blur … Read more

Getting post id from wp_insert_post_data function?

In the following, ’10’ is the priority that my_func gets called and ‘2’ is the number of arguments that my_func accepts. The latter is important, since the add_filter function defines the default as 1, but the wp_insert_post_data filter hook sends two arguments. If you don’t set this as 2 you won’t get the second argument. … Read more

add_action not using ‘delete_post’ action with wp_delete_post

You need to use before_delete_post action. As its already very late when delete_post action is run. WordPress un-attach all the attachments before running delete_post action. So when you run get_posts in your delete_attachment function there are no attachments found. So you need to hook your function to before_delete_post. add_action(‘before_delete_post’,’abc_delete_attachment’);

The ‘https_local_ssl_verify’ filter

The apply_filters() function lets plugins and themes override the value. So yes, you could manually set sslverify to false. The code snippet you included will set it to false in the absence of any filter. Let’s say I have a plugin that wants to force it to true. I would add this: add_filter( ‘https_local_ssl_verify’, ‘__return_true’ … Read more