Category: WordPress

  • Causes and countermeasures for the same article being displayed twice in WordPress category archives

    Causes and countermeasures for the same article being displayed twice in WordPress category archives

    When you encounter the issue of the same article being displayed twice in WordPress category archives, it can be frustrating for both site owners and visitors. This duplication can negatively impact user experience and SEO. Below are some common causes of this issue along with effective countermeasures to resolve it.

    (more…)
  • [Cocoon] Display a custom taxonomy if the currently displayed custom post type post has a custom taxonomy.

    [Cocoon] Display a custom taxonomy if the currently displayed custom post type post has a custom taxonomy.

    Cocoon uses nesting as a PHP structure, so it won’t work if you just modify single.php. First, copy single.php in the parent theme, place it in the child theme, change the file name to single-custom-post-type-name.php, and edit the following parts of the content. This will separate the behavior for custom post types.

    <?php //Post page content
    cocoon_template_part('tmp/single-contents-Custom-post-type-name'); ?>

    After that, create a folder called tmp in the child theme, duplicate the parent theme’s single-contents.php, place it in the child theme’s tmp folder, name it single-contents-custom-post-type-name.php, edit the following parts of the content. This is also one of the mechanisms to separate the behavior for custom post types.

    <?php //Body template
    cocoon_template_part('tmp/content-Custom-post-type-name') ?>

    After that, copy the parent theme’s content.php, place it in the child theme’s tmp folder, name it content-custom-post-type-name.php, and add the following part anywhere.

    <?php //Custom taxonomy categories/tags below the main text
            $post_type = get_post_type();
            $taxonomies = get_object_taxonomies($post_type, 'objects');
    
            $has_terms = false;
    
            if (!empty($taxonomies)) {
              foreach ($taxonomies as $taxonomy) {
                $terms = get_the_terms(get_the_ID(), $taxonomy->name);
                if ($terms && !is_wp_error($terms)) {
                  $has_terms = true;
                  // Show taxonomy name
                  echo '<h3>' . esc_html($taxonomy->label) . '</h3>';
                  echo '<ul>';
                  foreach ($terms as $term) {
                    $term_link = get_term_link($term);
                    if (!is_wp_error($term_link)) {
                      echo '<li><a href="' . esc_url($term_link) . '">' . esc_html($term->name) . '</a></li>';
                    } else {
                      echo '<li>' . esc_html($term->name) . '</li>';
                    }
                  }
                  echo '</ul>';
                }
              }
            }
            ?>

    By the way, I decided to put the above code directly below the code below.

    <?php //Categories/tags below the main text
            if (is_category_tag_display_position_content_bottom() && is_single()) {
              cocoon_template_part('tmp/categories-tags');
            } ?>
  • Simple Membership and Wordfence Login Security seem to be incompatible. Is there an alternative to the 2FA function?

    Simple Membership and Wordfence Login Security seem to be incompatible. Is there an alternative to the 2FA function?

    If you turn on 2FA in Wordfence Login Security while Simple Membership is turned on, you will not be able to log in. If you are locked out, you can re-enter by renaming the Wordfence Login Security folder using FTP and disabling it.

    If you are using Simple Membership and cannot use Wordfence Login Security but want to use 2FA when logging in, you can use All-In-One Security’s 2FA function (for now). However, All-In-One Security has a lot of functionality overlap with Siteguard WP Plugin which I also have it installed, so be careful when activating them at the same time. (Do not launch the same function from multiple plugins)

  • Plugin to optimize internal links

    Plugin to optimize internal links

    You can use “Internal Links Manager”.

  • An issue where the error message “Error! This site has the force WP user login feature enabled in the settings. We could not find a WP user record for the given username” appears with the Simple Membership plugin.

    An issue where the error message “Error! This site has the force WP user login feature enabled in the settings. We could not find a WP user record for the given username” appears with the Simple Membership plugin.

    Error! This site has the force WP user login feature enabled in the settings. We could not find a WP user record for the given username: Username

    This error is triggered when a member account doesn’t have a corresponding WP user account. So the plugin fails to log the user into the WP User system.

    Contact the site admin and request them to check your username in the WP Users menu to see what happened with the WP user entry of your account.

    The site admin can disable the Force WP User Synchronization feature in the settings to disable this feature and this error will go away.

    You can use the back button of your browser to go back to the site.

    If this problem occurs, it’s because it’s almost always causing a conflict with another plugin. It’s a good idea to find the conflicting plugin and disable it, but first try to see if you can log in from login.php instead of logging in from the membership-login page.

    If you still can’t log in, you have two options: find the conflicting plugin and disable it, or stop using Simple Membership. If you are able to log in, I think it would be a good idea to log in from the login.php page instead of using the membership-login page in the first place. In that case, go to Simple Membership, go to Settings, go to the General Settings tab, and change the Login Page URL. Similarly, it is a good idea to change the Password Reset Page URL as well. Then, it is a good idea to return the membership-login and password-reset pages to draft.

  • How do I change the message “You must be logged in to create new topics.” and add a registration link in bbPress?

    How do I change the message “You must be logged in to create new topics.” and add a registration link in bbPress?

    First, edit the message “You must be logged in to create new topics.”

    To change the “You must be logged in to create new topics.” message in bbPress, you can do the following:

    1. Create a child theme (if you don’t already have one).
    2. Create a “bbpress” folder inside the child theme folder.
    3. Create a “form-topic.php” file in the “bbpress” folder. (The original file is in the “Default” folder in the wp-content/plugins/bbpress/templates directory, so copy it to the bbPress folder in the child theme.)
    4. In the child theme’s form-topic.php file, use search to find a line similar to the following: “You must be logged in to create new topics.”
    5. Edit this line and change it to your desired message.

    If you want to add a registration link, do the following:

    _e( 'You must be logged in to create new topics.', 'bbpress' );

    Change this part as follows.

    printf( __( 'You must be logged in to create new topics. If you do not have an account, <a href="%s">register here.</a>', 'bbpress' ), esc_url( 'Registration URL here' ) );

    From a security perspective, this method (using the esc_url() function) is the most recommended. This method ensures that URLs are properly escaped and prevents potential vulnerabilities.

    Next, edit the message “You must be logged in to reply to this topic.”

    1. Create a “form-reply.php” file in the “bbpress” folder in the child theme’s folder. (The original file is in the “Default” folder in the wp-content/plugins/bbpress/templates directory, so copy it to the bbPress folder in the child theme.)
    2. In the child theme’s form-reply.php file, use search to find a line similar to the following: “You must be logged in to reply to this topic.”

    Find the message below.

    _e( 'You must be logged in to reply to this topic.', 'bbpress' );

    Replace this with the following.

    printf( __( 'You must be logged in to reply to this topic. If you do not have an account, <a href="%s">register here.</a>', 'bbpress' ), esc_url( 'Registration URL here' ) );

    Summary

    This way, you can safely make customizations without being affected by updates to WordPress’ parent theme or bbPress. Rather than bringing the entire bbPress Default folder to the child theme, it is best to copy only the necessary files and make changes.

  • New access analysis method in the cookieless era

    New access analysis method in the cookieless era

    The era of cookies is coming to an end. With growing awareness of privacy concerns, the use of cookies is increasingly being restricted. Cookie banners are bothersome for users and pose challenges for website operators. As we transition to a cookie-less era, new tracking methods using IP addresses and browser information are being explored. However, protecting privacy remains a critical issue.

    In this context, Matomo Analytics is gaining attention as a privacy-focused web analytics tool. It uses a system called “visitor config_id,” allowing for anonymous data analysis without collecting personal information. It complies with GDPR and is well-suited for the cookie-less era. This shift presents an opportunity to conduct effective web analytics while respecting user privacy.

  • Tumblr and WordPress.com were trying to sign a deal to provide user data for AI training

    Tumblr and WordPress.com were trying to sign a deal to provide user data for AI training

    Automattic, the parent company of Tumblr and WordPress.com, is reportedly entering into agreements to sell user data to AI companies OpenAI and Midjourney for the purpose of training AI models. The deal involves using data from Tumblr posts, and there is an option for users to opt out if they do not wish their content to be used for this purpose.

    Internal documents indicate that Automattic is preparing to compile and possibly sell a significant amount of user data, including public posts from 2014 to 2023. However, there have been issues with the inclusion of data that was not intended for sharing, such as private posts and content from deleted or suspended blogs. Automattic has stated its commitment to respecting user preferences regarding data sharing, including retroactively removing data from AI training datasets if users opt out.

    This move aligns with a broader trend in the industry, where platforms like Reddit have also engaged in similar partnerships with AI companies. These collaborations aim to leverage user-generated content to enhance AI capabilities while raising concerns about privacy and data usage among users.

  • Are you using Google Analytics?

    Are you using Google Analytics?

    No, not at this time. I use Matomo analytics.