Does WordPress handle concurrency and atomicity properly?

Does WordPress handle simultaneously requests properly The question is disingenuous and misleading, and can be rephrased as: Does WordPress use transactions or locking when making database queries? For which the answer is no. Because: When WP was introduced, transactions were not supported by MySQL Locking has major performance implications, and can also depend on the … Read more

different levels of nested comments per page

Please reference the Codex entry for wp_list_comments(). This function includes a ‘max_depth’ parameter in its args array. On the specific page in question, simply call: <?php wp_list_comments( array( ‘max_depth’ => ‘1’ ) ); ?> If you need more specific help, please clarify your question to indicate how you would identify the specific page in question. … Read more

Trigger function without awaiting response?

Since the program can be run from the command-line and no response is needed, using exec() does the job. http://php.net/manual/en/function.exec.php The first example in the comments (below) was used to run my command-line program on payment submission. The program launches and the user never awaits its completion. Shouldn’t matter if your machine is Windows or … Read more

Can I run a slow action in a seperate thread?

Techcrunch has released a library to spawn an asynchronous task within WordPress. https://github.com/techcrunch/wp-async-task Essentially, you can take any process that is triggered by an action hook, and you can defer the processing on that hook to run asynchronously. You extend the class to define which action you are triggering and a couple of functions to … Read more

Filtering Comment Reply Links (comment_reply_link_args) for “infinite replies” in nested comments

Here’s my solution. It relies on removing the original comment link and recreating it by appending it to the comment itself: https://www.webhostinghero.com/adding-infinite-replies-in-wordpress/ The only caveat is to make sure that wp_list_comments has been called with the default style argument. If it’s not, then that element needs to be changed as explained in my article. Most … Read more

Count comment threads, not total comments in a post

You could try this, must be used in the loop: <?php // type = comment will only get “real” comments, no ping-/trackbacks $comments = get_comments(array(‘type’ => ‘comment’)); $threads = 0; foreach($comments as $comment) { // if the comment has no parent, it´s the first of a thread if($comment->parent == ”) { $threads++; } } switch($threads) … Read more