Title: mariosem's Replies | WordPress.org

---

# mariosem

  [  ](https://wordpress.org/support/users/editor/)

 *   [Profile](https://wordpress.org/support/users/editor/)
 *   [Topics Started](https://wordpress.org/support/users/editor/topics/)
 *   [Replies Created](https://wordpress.org/support/users/editor/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/editor/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/editor/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/editor/engagements/)
 *   [Favorites](https://wordpress.org/support/users/editor/favorites/)

 Search replies:

## Forum Replies Created

Viewing 15 replies - 1 through 15 (of 111 total)

1 [2](https://wordpress.org/support/users/editor/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/editor/replies/page/3/?output_format=md)…
[6](https://wordpress.org/support/users/editor/replies/page/6/?output_format=md)
[7](https://wordpress.org/support/users/editor/replies/page/7/?output_format=md)
[8](https://wordpress.org/support/users/editor/replies/page/8/?output_format=md)
[→](https://wordpress.org/support/users/editor/replies/page/2/?output_format=md)

 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager] Snippet not appearing after creation](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [5 months ago](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/#post-18726330)
 * Hello,
 * As I wrote, the AI modified snippet is working properly.
 * Thanks
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager] Snippet not appearing after creation](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [5 months ago](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/#post-18725452)
 * Yes, that’s correct.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager] Snippet not appearing after creation](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [5 months ago](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/#post-18725194)
 * Yes, I confirm what you wrote. But, talking about the subject of this thread,
   no debug log has been produced, and the snippet can neither be activated nor 
   saved.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager] Snippet not appearing after creation](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [5 months ago](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/#post-18725132)
 * Hello, this is the error (site name edited):
 * [19-Nov-2025 06:46:55 UTC] PHP Fatal error: Cannot redeclare create_archived_post_status()(
   previously declared in /home2/XXXXXXX/public_html/wp-content/plugins/code-snippets/
   php/snippet-ops.php(663) : eval()’d code:2) in /home2/XXXXXX/public_html/wp-content/
   plugins/insert-headers-and-footers/includes/class-wpcode-snippet-execute.php(
   419) : eval()’d code on line 2
 * Actually, I think this is a different error, when today I activated your plugin
   and Code Snippets was also active. Currently, no other error is in the log. Moreover,
   no debug log is produced, after I changed the wp-config file, activating the 
   debug.
    -  This reply was modified 5 months ago by [mariosem](https://wordpress.org/support/users/editor/).
    -  This reply was modified 5 months ago by [mariosem](https://wordpress.org/support/users/editor/).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[WPCode - Insert Headers and Footers + Custom Code Snippets - WordPress Code Manager] Snippet not appearing after creation](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [5 months ago](https://wordpress.org/support/topic/snippet-not-appearing-after-creation/#post-18724719)
 * Hello,
 * Yes, I can save and see any other snippets. The snippet show 4 related posts,
   using a weighting of 65% tags and 35% categories, from the last 12 months, with
   a small thumbnail (120px). It is made by AI, as you can imagine. It works perfectly
   in another site of mine. As an aside, I just asked the AI to rewrite the code,
   and the new one works also with your plugin.
 * This is the code of the one that cannot be saved:
 *     ```wp-block-code
       /** * Related Posts Box * Mostra 4 post correlati basati su tag (65%) e categorie (35%) */// Aggiungi il box dei related posts dopo il contenutoadd_filter('the_content', 'phastidio_add_related_posts');function phastidio_add_related_posts($content) {    // Esegui solo sui post singoli, non su pagine o archivi    if (!is_single() || !is_main_query()) {        return $content;    }        global $post;    $related_posts = phastidio_get_related_posts($post->ID, 4);        if (empty($related_posts)) {        return $content;    }        $related_html = '<div class="phastidio-related-posts">';    $related_html .= '<h3 class="related-posts-title">Potrebbero interessarvi</h3>';    $related_html .= '<div class="related-posts-grid">';        foreach ($related_posts as $related_post) {        $thumbnail = get_the_post_thumbnail($related_post->ID, 'medium', array('class' => 'related-post-thumb'));        if (!$thumbnail) {            $thumbnail = '<div class="related-post-no-thumb"><span>📄</span></div>';        }                $related_html .= '<div class="related-post-item">';        $related_html .= '<a href="' . get_permalink($related_post->ID) . '" class="related-post-link">';        $related_html .= '<div class="related-post-image">' . $thumbnail . '</div>';        $related_html .= '<h4 class="related-post-title">' . esc_html($related_post->post_title) . '</h4>';        $related_html .= '<span class="related-post-date">' . get_the_date('j F Y', $related_post->ID) . '</span>';        $related_html .= '</a>';        $related_html .= '</div>';    }        $related_html .= '</div></div>';        return $content . $related_html;}function phastidio_get_related_posts($post_id, $limit = 4) {    // Ottieni tag e categorie del post corrente    $tags = wp_get_post_tags($post_id);    $categories = wp_get_post_categories($post_id);        if (empty($tags) && empty($categories)) {        return array();    }        $tag_ids = array();    $category_ids = array();        foreach ($tags as $tag) {        $tag_ids[] = $tag->term_id;    }        if (!empty($categories)) {        $category_ids = $categories;    }        // Query per post degli ultimi 12 mesi    $args = array(        'post_type' => 'post',        'post_status' => 'publish',        'posts_per_page' => 50,        'post__not_in' => array($post_id),        'date_query' => array(            array(                'after' => '12 months ago'            )        ),        'orderby' => 'date',        'order' => 'DESC'    );        // Aggiungi filtro per tag o categorie se presenti    if (!empty($tag_ids) || !empty($category_ids)) {        $tax_query = array('relation' => 'OR');                if (!empty($tag_ids)) {            $tax_query[] = array(                'taxonomy' => 'post_tag',                'field' => 'term_id',                'terms' => $tag_ids            );        }                if (!empty($category_ids)) {            $tax_query[] = array(                'taxonomy' => 'category',                'field' => 'term_id',                'terms' => $category_ids            );        }                $args['tax_query'] = $tax_query;    }        $related_query = new WP_Query($args);    $scored_posts = array();        if ($related_query->have_posts()) {        while ($related_query->have_posts()) {            $related_query->the_post();            $related_id = get_the_ID();                        // Calcola il punteggio            $score = 0;                        // Punteggio tag (65%)            if (!empty($tag_ids)) {                $post_tags = wp_get_post_tags($related_id);                $matching_tags = 0;                foreach ($post_tags as $post_tag) {                    if (in_array($post_tag->term_id, $tag_ids)) {                        $matching_tags++;                    }                }                $tag_score = ($matching_tags / count($tag_ids)) * 0.65;                $score += $tag_score;            }                        // Punteggio categorie (35%)            if (!empty($category_ids)) {                $post_categories = wp_get_post_categories($related_id);                $matching_cats = 0;                foreach ($post_categories as $post_cat) {                    if (in_array($post_cat, $category_ids)) {                        $matching_cats++;                    }                }                $cat_score = ($matching_cats / count($category_ids)) * 0.35;                $score += $cat_score;            }                        if ($score > 0) {                $scored_posts[] = array(                    'post' => get_post($related_id),                    'score' => $score                );            }        }        wp_reset_postdata();    }        // Ordina per punteggio decrescente    if (!empty($scored_posts)) {        usort($scored_posts, function($a, $b) {            return $b['score'] <=> $a['score'];        });    }        // Restituisci i top N post    $result = array();    $count = 0;    foreach ($scored_posts as $scored_post) {        if ($count >= $limit) break;        $result[] = $scored_post['post'];        $count++;    }        return $result;}// Aggiungi gli stili CSSadd_action('wp_head', 'phastidio_related_posts_styles');function phastidio_related_posts_styles() {    if (!is_single()) return;    ?>    <style>        .phastidio-related-posts {            margin: 40px 0;            padding: 25px;            background: #f8f9fa;            border-radius: 8px;            border-left: 4px solid #0073aa;        }                .related-posts-title {            margin: 0 0 20px 0;            font-size: 22px;            font-weight: 600;            color: #333;        }                .related-posts-grid {            display: grid;            grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));            gap: 15px;        }                .related-post-item {            background: #fff;            border-radius: 6px;            overflow: hidden;            box-shadow: 0 2px 8px rgba(0,0,0,0.1);            transition: transform 0.3s ease, box-shadow 0.3s ease;        }                .related-post-item:hover {            transform: translateY(-4px);            box-shadow: 0 4px 16px rgba(0,0,0,0.15);        }                .related-post-link {            text-decoration: none;            color: inherit;            display: block;        }                .related-post-image {            position: relative;            width: 100%;            height: 120px;            overflow: hidden;            background: #e9ecef;        }                .related-post-image img {            width: 100%;            height: 100%;            object-fit: cover;        }                .related-post-no-thumb {            width: 100%;            height: 100%;            display: flex;            align-items: center;            justify-content: center;            font-size: 48px;            background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);            color: #fff;        }                .related-post-title {            margin: 0;            padding: 12px 12px 8px;            font-size: 16px;            font-weight: 600;            line-height: 1.4;            color: #333;        }                .related-post-date {            display: block;            padding: 0 12px 12px;            font-size: 12px;            color: #666;        }                @media (max-width: 768px) {            .related-posts-grid {                grid-template-columns: 1fr;            }                        .related-post-image {                height: 150px;            }        }    </style>    <?php}
       ```
   
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Code Snippets] Too many minor updates](https://wordpress.org/support/topic/too-many-minor-updates/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [5 months ago](https://wordpress.org/support/topic/too-many-minor-updates/#post-18724550)
 * Hello,
 * Thanks for your reply. In my site I’m using about a dozen plugins. No one has
   the release cycle of Code Snippets. And no one has the number of minor releases
   just to fix bugs of Code Snippets. In my opinion, that means that updates are
   not going smoothly. One plugin I’m using has a monthly release schedule and no
   subsequent fix updates.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Super Page Cache] Percentage cached on Cloudflare](https://wordpress.org/support/topic/percentage-cached-on-cloudflare/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [1 year ago](https://wordpress.org/support/topic/percentage-cached-on-cloudflare/#post-18420504)
 * Yes, [it’s on](https://imgur.com/a/Evtl0JF).
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Super Page Cache] Percentage cached on Cloudflare](https://wordpress.org/support/topic/percentage-cached-on-cloudflare/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [1 year ago](https://wordpress.org/support/topic/percentage-cached-on-cloudflare/#post-18419360)
 * I’m using Litespeed Cache plugin, yes. I’ve disabled it to use your plugin.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Super Page Cache] Percentage cached on Cloudflare](https://wordpress.org/support/topic/percentage-cached-on-cloudflare/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [1 year ago](https://wordpress.org/support/topic/percentage-cached-on-cloudflare/#post-18419310)
 * Hi Kush,
 * Thanks for your reply.
 * I was asking because I’m getting on average 20%, and peaks never go above 40%.
 * Mario
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Super Page Cache] Use with wordpress.com and link to dashboard](https://wordpress.org/support/topic/use-with-wordpress-com-and-link-to-dashboard/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/use-with-wordpress-com-and-link-to-dashboard/#post-16694739)
 * Thanks [@isaumya](https://wordpress.org/support/users/isaumya/),
 * when I tried for the first time your plugin, the cache hit ratio plunged, and
   I had the problem of the disappearing link to the dashboard. That’s why I’ve 
   given up. I will try again.
 * Moreover, in wordpress.com the .htaccess file is not writable.
 * Last question: do I have to use all the cache rules you show in your example,
   or just a few? I would like to keep things as simplest as possible.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Super Page Cache] Use with wordpress.com and link to dashboard](https://wordpress.org/support/topic/use-with-wordpress-com-and-link-to-dashboard/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [2 years, 11 months ago](https://wordpress.org/support/topic/use-with-wordpress-com-and-link-to-dashboard/#post-16693278)
 * Hi [@isaumya](https://wordpress.org/support/users/isaumya/),
 * thanks for your answer. I had already followed points 1 to 3, I had no page rules
   at all, I have meanwhile activated Smart Tiered Cache and Cache Reserve.
 * I will follow your suggestion about point 7.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Cloudflare] Problem after update to WP 6.1](https://wordpress.org/support/topic/problem-after-update-to-wp-6-1/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/problem-after-update-to-wp-6-1/#post-16375178)
 * I have deactivated and reactivated the Cloudflare plugin, now it works.
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Slim SEO - A Fast & Automated SEO Plugin For WordPress] Customizing the text in the RSS anti-scrape link](https://wordpress.org/support/topic/customizing-the-text-in-the-rss-anti-scrape-link/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [3 years, 3 months ago](https://wordpress.org/support/topic/customizing-the-text-in-the-rss-anti-scrape-link/#post-16319907)
 * Hi [@rilwis](https://wordpress.org/support/users/rilwis/),
 * very useful, thanks!
 * Mario
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[The SEO Framework – Fast, Automated, Effortless.] Data transport not available for SEOPress](https://wordpress.org/support/topic/data-transport-not-available-for-seopress/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [4 years ago](https://wordpress.org/support/topic/data-transport-not-available-for-seopress/#post-15497978)
 * Hi Sybre,
 * thanks for your answer. Unfortunately, my site is quite old and has 8.000+ posts,
   and has rather heavy traffic. I think it’s better for me to wait for a transporter,
   in the future, before moving to TSF.
 * Thanks,
 * Mario
 *   Forum: [Plugins](https://wordpress.org/support/forum/plugins-and-hacks/)
    In
   reply to: [[Flying Scripts: Delay JavaScript to Improve Site Speed & Performance] No improvement](https://wordpress.org/support/topic/no-improvement-3/)
 *  Thread Starter [mariosem](https://wordpress.org/support/users/editor/)
 * (@editor)
 * [4 years, 9 months ago](https://wordpress.org/support/topic/no-improvement-3/#post-14606770)
 * Currently I’ve added adsbygoogle.js

Viewing 15 replies - 1 through 15 (of 111 total)

1 [2](https://wordpress.org/support/users/editor/replies/page/2/?output_format=md)
[3](https://wordpress.org/support/users/editor/replies/page/3/?output_format=md)…
[6](https://wordpress.org/support/users/editor/replies/page/6/?output_format=md)
[7](https://wordpress.org/support/users/editor/replies/page/7/?output_format=md)
[8](https://wordpress.org/support/users/editor/replies/page/8/?output_format=md)
[→](https://wordpress.org/support/users/editor/replies/page/2/?output_format=md)