Guests comment form – prevent duplicate email addresses

function preprocess_mycomment($commentdata) { $existing_comments = get_comments( array(‘post_id’ => 31691) ); // I run the code for one specific page only foreach ($existing_comments as $comment) { $previous_comments = $comment->comment_author_email; // email address send by the current poster if ( $previous_comments == $commentdata[‘comment_author_email’] ) { // comparing the current email address with the previous ones in database. … Read more

theme.json is altering Group block HTML

I was able to prevent the unwanted altering of HTML by using the render_block_core/group filter, and a copy of wp_restore_group_inner_container, without the JSON support check. public static function my_add_block_group_inner( $block_content, $block ) { $tag_name = isset( $block[‘attrs’][‘tagName’] ) ? $block[‘attrs’][‘tagName’] : ‘div’; $group_with_inner_container_regex = sprintf( ‘/(^\s*<%1$s\b[^>]*wp-block-group(\s|”)[^>]*>)(\s*<div\b[^>]*wp-block-group__inner-container(\s|”)[^>]*>)((.|\S|\s)*)/U’, preg_quote( $tag_name, “https://wordpress.stackexchange.com/” ) ); $replace_regex = sprintf( ‘/(^\s*<%1$s\b[^>]*wp-block-group[^>]*>)(.*)(<\/%1$s>\s*$)/ms’, … Read more

is_user_logged_in() undefined at shutdown in plugin context

Edit 1 – Does not work // Catch is_user_logged_in() value before shutdown function is_user_logged_in_init() { $is_user_logged_in_init = is_user_logged_in() ?? false; } add_action(‘init’, ‘is_user_logged_in_init’); Leaving this here for my reference. Ref Edit 2 – Works I found two ways to solve this: Option 1 – Not recommended Ref include_once ABSPATH.’wp-includes/pluggable.php’; Option 2 – Rewrite the script, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)