Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • To resolve the transparent header issue and prevent logo/content overlap, here’s a structured solution:

    1. CSS Fix for Header Background

    Add this CSS code to your theme’s customizer (Appearance → Customize → Additional CSS):

    /* Add solid background to header */
    .wp-block-group.your-header-class { /* Target your header block */
        background: #ffffff !important; /* White background */
        box-shadow: 0 2px 10px rgba(0,0,0,0.1); /* Optional shadow */
        position: fixed;
        top: 0;
        width: 100%;
        z-index: 1000; /* Ensure header stays above content */
    }
    
    /* Add spacing to first content element */
    .wp-block-group:first-child {
        margin-top: 100px !important; /* Match header height */
    }

    Key Features:

    • position: fixed keeps header visible during scroll
    • z-index: 1000 ensures proper layering
    • Margin compensation prevents content underlap

    2. Alternative Block-Based Solution

    1. Edit your header block
    2. In block settings → Advanced → Additional CSS Class: add solid-header
    3. Use this CSS:
    .solid-header {
        background: var(--wp--preset--color--white) !important;
        padding: 20px 0 !important;
        transition: all 0.3s ease;
    }
    
    /* Scrolled state */
    .scrolled .solid-header {
        box-shadow: 0 2px 15px rgba(0,0,0,0.1);
        padding: 15px 0 !important;
    }

    3. JavaScript for Dynamic Header (Optional)

    Add this to create a more polished scroll effect:

    // Add to footer or custom HTML block
    <script>
    document.addEventListener('DOMContentLoaded', function() {
        const header = document.querySelector('.your-header-class');
        window.addEventListener('scroll', function() {
            if (window.scrollY > 100) {
                header.classList.add('scrolled');
            } else {
                header.classList.remove('scrolled');
            }
        });
    });
    </script>

    4. Verification Steps

    1. Use browser DevTools (F12) to:
    • Check element positioning
    • Verify z-index values
    • Test different background colors
    1. Ensure no conflicting theme CSS exists
    2. Test on mobile (add media queries if needed)

    Pro Tip: For gradient backgrounds, use:

    background: linear-gradient(90deg, #ffffff 0%, #f8f9fa 100%);

    This solution maintains block editor compatibility while ensuring proper header behavior across devices. Adjust pixel values to match your design requirements.

    • This reply was modified 1 year, 2 months ago by saghir daska.

    This WordPress admin hanging issue after multiple saves is a known problem in Chromium-based browsers (Chrome, Edge, etc.) that’s been reported by several users. Here’s a comprehensive approach to resolve it:

    1. Immediate Workarounds<gwmw style=”display:none;”></gwmw>

    // Add to wp-config.php
    define('WP_HTTP_BLOCK_EXTERNAL', false); // If using localhost
    define('DISABLE_WP_CRON', true); // Then set up real cron jobs

    Browser Fixes:

    • Use Shift+Ctrl+R for hard refresh between saves
    • Disable HTTP/2 in Chrome flags: chrome://flags/#enable-quic
    • Try Firefox as alternative browser

    2. Connection Limit Fixes

    # Add to server config (nginx)
    keepalive_requests 1000;
    keepalive_timeout 300s;
    # For Apache (.htaccess)
    <IfModule mod_headers.c>
        Header set Connection keep-alive
    </IfModule>

    3. WordPress Core Adjustments

    // Add to theme's functions.php
    add_filter( 'wp_is_application_passwords_available', '__return_false' ); // Disable REST API auth
    add_filter( 'rest_authentication_errors', function($result) {
        return is_user_logged_in() ? $result : new WP_Error('rest_disabled', __('REST API disabled for anonymous users'), array('status' => 401));
    });

    4. PHP Session Handling

    ; php.ini adjustments
    session.auto_start = 0
    session.gc_probability = 0
    session.cookie_lifetime = 0

    5. Database Optimization

    -- Run in phpMyAdmin
    ALTER TABLE wp_options ENGINE=InnoDB;
    ALTER TABLE wp_posts ENGINE=InnoDB;
    SET GLOBAL max_connections = 200;
    SET GLOBAL wait_timeout = 600;

    6. Advanced Fixes

    1. WP-CLI Cache Flush
    wp cache flush --skip-plugins --skip-themes
    1. Disable Browser Features
    // Chrome console test (DevTools)
    window.addEventListener('beforeunload', function(e) {
        window.onbeforeunload = null;
    });
    1. Resource Monitoring
    # Linux server monitoring
    watch -n 1 "netstat -ant | grep ':443\|:80' | awk '{print \$6}' | sort | uniq -c"

    7. Plugin-Specific Solutions

    1. Heartbeat Control
    // Add to functions.php
    add_filter('heartbeat_settings', function($settings) {
        $settings['interval'] = 120; // Slow heartbeat
        return $settings;
    });
    1. Disable Non-Core Features
    // Disable Gutenberg's auto-save
    add_filter('block_editor_settings_all', function($settings) {
        $settings['autosaveInterval'] = 0;
        return $settings;
    });

    8. Alternative Save Methods

    1. WP-CLI Save
    wp post update 123 --post_title="New Title" --post_content="New Content"
    1. REST API Save
    // Example using fetch
    fetch('/wp-json/wp/v2/posts/123', {
        method: 'POST',
        headers: {
            'Content-Type': 'application/json',
            'X-WP-Nonce': 'your_nonce_here'
        },
        body: JSON.stringify({
            title: 'Updated Title',
            content: 'Updated Content'
        })
    });

    9. Troubleshooting Flowchart

    1. Test in Incognito mode (no extensions)
    2. Check wp-admin/network/admin.php if multisite
    3. Monitor browser’s Network tab for 502/504 errors
    4. Check PHP-FPM status: sudo systemctl status php-fpm
    5. Verify InnoDB status: SHOW ENGINE INNODB STATUS

    10. **Preventative Measures

    // Auto-clear transients
    add_action('save_post', function($post_id) {
        if (wp_is_post_revision($post_id)) return;
        wp_cache_flush();
        delete_transient('wp_admin_css_colors');
    });

    This combination of server config tweaks, WordPress optimizations, and browser adjustments should resolve the hanging issue. The root cause appears to be a combination of Chromium’s connection pooling and WordPress’ REST API/autosave interactions. If problems persist, consider using the Classic Editor plugin as a temporary workaround while debugging.<gwmw style=”display:none;”></gwmw><gwmw style=”display:none;”></gwmw>

    To address the layout and sizing issues in your WordPress block editor, let’s focus on key CSS adjustments. Here’s a step-by-step solution:

    1. Expand Gallery Container Width:
    /* Remove max-width constraints on gallery container */
    .wp-block-group.hostinger-ai-gallery-1 {
        max-width: none !important;
    }
    
    /* Expand inner containers */
    .hostinger-ai-gallery-1 .alignwide {
        max-width: 1280px; /* Adjust as needed */
        margin: 0 auto;
    }
    1. Image Scaling:
    /* Make images fill their containers */
    .hostinger-ai-image img {
        width: 100%;
        height: auto;
        object-fit: contain;
    }
    
    /* For MetaSlider */
    .alignnormal .metaslider {
        max-width: 100% !important;
    }
    1. Layout Adjustments:
    /* Remove default spacing */
    .hostinger-ai-gallery-1 .wp-block-group {
        padding-left: 0;
        padding-right: 0;
    }
    
    /* Flex layout adjustments */
    .hostinger-ai-gallery-1 .wp-block-group[class*="alignwide"] {
        gap: 2%; /* Control spacing between images */
        flex-wrap: wrap;
    }
    1. Text Sizing:
    /* Adjust text elements */
    .hostinger-ai-title {
        font-size: 2.5rem !important;
    }
    
    .hostinger-ai-description {
        font-size: 1.25rem !important;
        max-width: 800px;
        margin-left: auto !important;
        margin-right: auto !important;
    }

    Implementation Tips:

    1. Add these styles in Appearance → Customize → Additional CSS
    2. Use browser Dev Tools (F12) to test adjustments
    3. For MetaSlider, check slider settings → ensure “Stretch” option is enabled
    4. Consider using !important only if necessary to override theme styles

    Additional Recommendations:

    • Check if your theme has a “Boxed Layout” option that might constrain widths
    • Consider using the Group block’s “Content Width” setting in block settings
    • For better image quality, ensure your source images are at least 2x the display size

    If the issue persists, please share your site URL or screenshots for more targeted adjustments.

    • This reply was modified 1 year, 2 months ago by saghir daska.

    The issue is that your Content Security Policy (CSP) is too restrictive, blocking essential resources. Let’s break down the problem and solution: 1. Syntax Error in Referrer-Policy

    Your Referrer-Policy header has a colon (:) in the directive, which is invalid. Use this instead:

    Header set Referrer-Policy "no-referrer-when-downgrade"

    2. Overly Restrictive CSP

    Your current policy (default-src 'none') blocks everything by default. Here’s why your site breaks:

    • Missing font-src: If your site uses fonts (e.g., from WordPress or Google Fonts).
    • Inline scripts/styles: Common in WordPress (e.g., inline <script> tags).
    • External resources: CDNs, analytics, or third-party content.

    Recommended Fix

    Start with a safer CSP and gradually tighten it. Use this as a baseline in your .htaccess:

    Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self';"

    Key Changes:

    1. default-src 'self': Allows same-origin resources by default.
    2. 'unsafe-inline': Temporarily allows inline scripts/styles (common in WordPress).
    3. data: for images: Permits images embedded via data: URIs.
    4. Added font-src: Allows fonts hosted on your domain.

    Next Steps:

    1. Check Browser Console: Look for CSP violation errors to identify blocked resources.
    2. Replace 'unsafe-inline': Use nonces or hashes for inline scripts/styles in production.
    3. Add Exceptions: Include external domains (e.g., https://fonts.googleapis.com for Google Fonts).

    Example Enhanced Policy:

    Header set Content-Security-Policy "default-src 'self'; script-src 'self' https://trusted-cdn.com; style-src 'self' 'unsafe-inline' https://fonts.googleapis.com; img-src 'self' data: https://stats.example.com; font-src 'self' https://fonts.gstatic.com; connect-src 'self';"

    Final .htaccess Section:

    <IfModule mod_headers.c>
      Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
      Header set X-XSS-Protection "1; mode=block"
      Header set X-Content-Type-Options "nosniff"
      Header set X-Frame-Options "SAMEORIGIN"
      Header set Referrer-Policy "no-referrer-when-downgrade"
      Header set Content-Security-Policy "default-src 'self'; script-src 'self' 'unsafe-inline'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self'; connect-src 'self';"
    </IfModule>

    Testing Tools:

    • Use CSP Evaluator to audit your policy.
    • Enable report-uri in CSP to collect violation reports during testing.
    • This reply was modified 1 year, 2 months ago by saghir daska.

    Let’s troubleshoot and refine your auto-scroll implementation. The core issue likely involves timingelement selection, or scroll behavior conflicts.
    Here’s a step-by-step solution:

    1. Fix Timing Issues

    The DOMContentLoaded event might fire before WordPress or Relevanssi finishes rendering search results. Use a delayed check or observe dynamic content:

    javascript

    function scrollToSearchTerm() { const hash = window.location.hash; if (hash.startsWith(“#search-“)) { const searchTerm = hash.replace(“#search-“, “”).replace(/-/g, ” “); const regex = new RegExp(\\b${searchTerm}\\b, “gi”); // Match whole words // Wait for Relevanssi highlights (delay execution) setTimeout(() => { // Target highlighted terms directly (Relevanssi adds <mark> tags) const markedElements = document.querySelectorAll(“mark”); if (markedElements.length > 0) { markedElements[0].scrollIntoView({ behavior: “auto”, block: “center”, inline: “nearest” }); } }, 500); // Adjust delay based on page load speed } } // Run on initial load and hash changes window.addEventListener(“load”, scrollToSearchTerm); window.addEventListener(“hashchange”, scrollToSearchTerm);

    2. Improve Element Targeting

    Instead of iterating through all paragraphs/headings:

    • Target Relevanssi’s existing highlights (they already wrap the term in <mark> tags).
    • Use document.querySelector("mark") to jump to the first highlighted instance.

    3. Adjust Scroll Behavior

    • Ensure you’re not conflicting with nested scroll containers (e.g., if your theme uses a custom scrollable div).
    • Force the main window to scroll instead of a child container:
    • javascript
    • // Add this if scrolling a parent container document.documentElement.scrollIntoView({ behavior: “auto” });<gwmw style=”display:none;”></gwmw><gwmw style=”display:none;”></gwmw>

    4. Debugging Stepsa. Check Console for Errors

    • Open the browser console (F12 → Console) to see if JavaScript errors occur when clicking search results.

    b. Log Values

    Add debug statements to your code:

    javascript

    console.log(“Search term:”, searchTerm); console.log(“Marked elements found:”, markedElements.length);

    c. Test URL Structure<gwmw style=”display:none;”></gwmw>

    Ensure the URL hash after a search is formatted correctly (e.g., #search-example-term). Relevanssi or your theme might be overriding this.

    5. Alternative Approach: Use Relevanssi Hooks<gwmw style=”display:none;”></gwmw>

    Relevanssi has filters for custom behavior. Instead of relying on URL hashes:

    php

    // Add to functions.php or WPCode Snippet add_action(‘relevanssi_search_results’, ‘custom_scroll_to_highlight’); function custom_scroll_to_highlight($results) { if (!empty($results)) { echo ‘<script> window.location.hash = “search-‘ . urlencode(get_search_query()) . ‘”; </script>’; } return $results; }

    6. CSS Fixes

    Ensure highlighted <mark> elements are not hidden or styled in a way that breaks scrolling:

    css

    mark { background-color: #6e35ae; color: yellow; /* Add this to ensure marks are visible/scrollable */ position: relative; z-index: 9999; }

    7. Final Code Example

    Here’s a consolidated version:

    javascript

    function scrollToSearchTerm() { const hash = window.location.hash; if (hash.startsWith(“#search-“)) { const searchTerm = hash.replace(“#search-“, “”).replace(/-/g, ” “); // Wait for Relevanssi to highlight terms setTimeout(() => { const markedElements = document.querySelectorAll(“mark”); if (markedElements.length > 0) { markedElements[0].scrollIntoView({ behavior: “auto”, block: “center” }); } else { console.warn(“No highlighted terms found.”); } }, 750); // Increase delay if page loads slowly } } // Initialize window.addEventListener(“load”, scrollToSearchTerm); window.addEventListener(“hashchange”, scrollToSearchTerm);

    Key Takeaways:

    • Timing: Wait for Relevanssi to finish highlighting terms.
    • Targeting: Use <mark> elements created by Relevanssi instead of reinventing highlighting.
    • Debugging: Check for JavaScript errors and ensure the URL hash is properly formatted.

    If issues persist, share:

    1. Browser console errors.
    2. A live example URL (if possible).
    3. Whether your theme uses AJAX to load search results (this would require additional handling).
    • This reply was modified 1 year, 2 months ago by saghir daska.

    To resolve the issue with the “Save Draft” functionality in WordPress after an update, follow these steps systematically:1. Basic Troubleshooting

    • Clear Browser Cache: Outdated cached files might interfere. Use Ctrl + F5 (Windows) or Cmd + Shift + R (Mac) to hard-refresh.
    • Test in Another Browser/Device: Check if the issue persists in a different browser (e.g., Firefox, Safari) or incognito mode.

    2. Check for Plugin/Theme Conflicts

    • Disable All Plugins:
      1. Go to Plugins → Installed Plugins.
      2. Select all plugins and choose Deactivate from the bulk actions menu.
      3. Test if “Save Draft” works. If it does, reactivate plugins one by one to identify the culprit.
    • Switch to a Default Theme:
      1. Navigate to Appearance → Themes.
      2. Activate a default theme (e.g., Twenty Twenty-Three). Test again.

    3. Check for JavaScript Errors

    • Open Browser Console:
      • In Chrome/Firefox: Ctrl + Shift + J (Windows) or Cmd + Opt + J (Mac).
    • Look for red error messages while clicking “Save Draft”. Note any errors related to plugins/themes or WordPress core.

    4. User Permissions

    • Ensure your user role (e.g., Administrator, Editor) has the edit_posts and edit_published_posts capabilities.
    • Test with a new admin account (Users → Add New) to rule out profile corruption.

    5. Reinstall WordPress Core

    • Go to Dashboard → Updates.
    • Click Re-install Now to refresh core files without affecting content.

    6. Database Repair

    • Add the following line to wp-config.php (via FTP/cPanel):phpCopydefine(‘WP_ALLOW_REPAIR’, true);
    • Visit https://yoursite.com/wp-admin/maint/repair.php and run Repair Database.

    7. Use Health Check Plugin<gwmw style=”display:none;”></gwmw>

    • Install the Health Check Plugin.
    • Use Troubleshooting Mode to disable plugins/themes for your session only.
    • Check Site Health Status (Tools → Site Health) for critical issues.

    8. Check Server Error Logs

    • Access your hosting control panel (e.g., cPanel) and look for Error Logs.
    • Check for PHP errors, memory limits, or security module blocks (e.g., mod_security).

    9. Temporary Workaround

    • Use keyboard shortcuts: Ctrl + S (Windows) or Cmd + S (Mac) may still trigger a draft save.

    10. Seek Further Help

    • If unresolved:
      • Post details in the WordPress Support Forum.
      • Contact your hosting provider to check server-side issues (e.g., broken AJAX handlers).

    <gwmw style=”display:none;”></gwmw>

Viewing 6 replies - 1 through 6 (of 6 total)