Forum Replies Created

Viewing 5 replies - 1 through 5 (of 5 total)
  • Hi @mmihelic,

    To protect against loops and avoid issues like the one you’ve described (recursive RSS feed calls causing 503 errors), consider the following solutions:

    1. Validate RSS URLs Before Usage

    You can implement validation to ensure only proper RSS feed URLs (/feed) are allowed:

    • Use a Custom Widget Validation: Modify the RSS widget or use a plugin to validate user input. You can use a regex pattern to ensure the URL contains /feed: function validate_rss_feed_url($url) { return preg_match('/\/feed$/', $url) ? $url : false; } Add this validation to the RSS widget logic.
    • Prevent Saving Invalid URLs: Hook into the widget save action and block invalid URLs: add_filter('widget_update_callback', function($instance, $new_instance, $old_instance) { if (isset($new_instance['url']) && !validate_rss_feed_url($new_instance['url'])) { return $old_instance; // Revert to old instance } return $new_instance; }, 10, 3);

    2. Rate-Limit RSS Requests

    Add rate-limiting rules to your server configuration to avoid excessive RSS feed requests:

    • Using NGINX: limit_req_zone $binary_remote_addr zone=rss_zone:10m rate=5r/s; location /feed { limit_req zone=rss_zone burst=10; }
    • Using Apache: Use mod_evasive or mod_security to limit requests to /feed.

    3. Add Recursive Call Detection

    Modify the RSS parser to detect and stop recursive loops:

    • Custom RSS Fetching Logic: Create a custom RSS fetching function that tracks the source of RSS requests. For example: function fetch_rss_feed($url) { static $rss_call_stack = []; if (in_array($url, $rss_call_stack)) { return 'Error: Recursive loop detected.'; } $rss_call_stack[] = $url; $rss = simplexml_load_file($url); array_pop($rss_call_stack); return $rss; }
    • Replace the default RSS parser with this custom logic.

    4. Limit RSS Embedding Permissions

    Restrict who can embed RSS feeds to prevent inexperienced users from causing issues:

    • Modify User Roles: Ensure only users with specific roles (e.g., Admins) can add RSS feed widgets. Use a plugin like User Role Editor or add custom code: add_filter('current_user_can', function($capability, $args) { if ($args[0] === 'edit_theme_options' && !current_user_can('manage_options')) { return false; } return $capability; }, 10, 2);

    5. Use Caching for RSS Feeds

    Implement caching to reduce the frequency of RSS feed processing:

    • Plugin-Based Caching: Install plugins like WP Super Cache or W3 Total Cache, which can cache RSS feeds.
    • Custom RSS Cache: Cache RSS responses in the database: function cached_rss_feed($url) { $cache_key = 'rss_cache_' . md5($url); $cached_feed = get_transient($cache_key); if ($cached_feed) { return $cached_feed; } $rss = simplexml_load_file($url); set_transient($cache_key, $rss, HOUR_IN_SECONDS); return $rss; }

    6. Monitor and Block Misconfigured URLs

    Proactively detect and block invalid RSS requests:

    • Server-Side Logs: Monitor logs for excessive requests to invalid RSS URLs and block them using:
      • NGINX deny rules.
      • WordPress REST API filters to block specific patterns.
    • Plugin-Based Approach: Use plugins like Wordfence to monitor, limit, or block repeated invalid requests.

    7. Add a Rate-Limiting Middleware to RSS Feeds

    Implement middleware to throttle access to RSS feeds:

    • PHP Middleware: Add middleware logic to functions.php: add_action('template_redirect', function() { if (is_feed()) { $ip = $_SERVER['REMOTE_ADDR']; $cache_key = 'rss_request_' . md5($ip); $request_count = get_transient($cache_key) ?: 0; if ($request_count >= 10) { wp_die('Too many requests. Please try again later.'); } set_transient($cache_key, $request_count + 1, 60); } });

    8. Educate Users

    Provide users with clear documentation on how to properly use RSS feeds in widgets, emphasizing the need to use valid URLs (/feed).

    Conclusion

    The best approach depends on your needs, but combining user input validation, caching, rate limiting, and monitoring will significantly reduce the risk of such loops. If you’re managing a multisite network, enforce best practices to ensure smooth operations.

    Hi @brentrambo,

    Creating a dynamic and modern full-page layout like the one in the CodePen example while still leveraging WordPress blocks can be challenging but is entirely possible. Below, I’ll guide you through the different approaches and tools available to achieve this effectively while maintaining scalability and ease of editing.

    1. Using WordPress Blocks (Without Page Builders)

    WordPress blocks (Gutenberg editor) can handle custom layouts and designs to a degree, but they are not inherently designed for complex “full-page effects.” However, you can extend their capabilities with the following approaches:Custom HTML Block

    • How to Use:
      • Place your HTML code in a custom HTML block.
      • Add your CSS either in the block’s “Advanced > Additional CSS Class(es)” or through the Site Editor under “Additional CSS.”
    • Pros:
      • Great for smaller custom sections.
      • No need for extra plugins or themes.
    • Cons:
      • Becomes unwieldy for complex designs.
      • Difficult to maintain and edit without coding knowledge.

    Group and Columns Blocks

    • How to Use:
      • Use the “Group” block to structure your content and apply background images, colors, or effects.
      • Nest “Columns” blocks inside for layout flexibility.
    • Pros:
      • Native WordPress feature; no additional plugins.
      • User-friendly editing.
    • Cons:
      • Limited design flexibility.
      • Effects like parallax or animations require custom CSS or JavaScript.

    Block Enhancer Plugins

    Consider plugins to extend Gutenberg’s capabilities:

    • Stackable or Kadence Blocks
      These plugins provide advanced block designs with built-in effects like parallax, animations, and layout controls.
    • Pros:
      • No coding required.
      • Fully integrated with WordPress blocks.
    • Cons:
      • Might still lack some advanced customization options.

    2. Using Full Site Editing (FSE)

    With FSE (enabled in block themes like Twenty Twenty-Three):

    • Use template parts to create layouts.
    • Apply global styles directly within the editor.
    • Add custom CSS for animations and effects under Appearance > Editor > Styles > Additional CSS.

    Note: FSE is still maturing and might not fully match the flexibility of page builders for complex designs.3. Page Builders for Full Control

    Page builders like Elementor, Beaver Builder, or Divi are designed for creating advanced layouts with ease. Here’s how they can help:Why Use Page Builders?

    • Drag-and-Drop Ease: Create complex layouts without writing HTML or CSS.
    • Built-in Effects: Add animations, parallax scrolling, and full-page designs easily.
    • Theme Integration: Most page builders work seamlessly with WordPress themes.

    How to Use:

    1. Install a page builder plugin (Elementor Free is a great start).
    2. Create your page using the builder’s interface.
    3. Apply custom CSS or JavaScript for additional effects, if needed.

    Cons:

    • Adds extra weight to your site (may slow down performance if not optimized).
    • Lock-in effect (difficult to switch builders later).

    4. Hybrid Approach: Blocks + Custom CSS/JS

    • Recommended for Developers:
      1. Use Gutenberg blocks for base structure.
      2. Add custom CSS and JavaScript to achieve advanced effects.
      3. Save reusable blocks for similar sections to avoid duplication.
    • Where to Add Code:
      • Use the Additional CSS area in WordPress Customizer.
      • Add scripts using plugins like Code Snippets or enqueue them in your theme’s functions.php.

    5. Tools for Modern Effects

    If you want advanced animations or interactivity:

    • CSS Libraries: Use frameworks like Tailwind CSS or animate.css for modern effects.
    • JavaScript Libraries: Integrate libraries like GSAP or ScrollMagic for scroll-triggered animations.

    6. What You’re Missing

    The challenge with copying/pasting fully designed blocks into an HTML block is that:

    1. It bypasses the block editor’s intended workflow, making editing harder.
    2. It might introduce conflicts if you change themes or plugins later.

    Solution:

    • Use reusable blocks, templates, or a child theme to manage custom layouts.
    • If editing ease is crucial, invest in a block enhancer plugin or a page builder.

    Conclusion

    • For code-heavy designs: Use custom HTML/CSS within blocks, with reusable block templates for consistency.
    • For ease of use: Consider block enhancer plugins or a page builder like Elementor.
    • For advanced effects: Combine WordPress blocks with lightweight CSS/JavaScript frameworks.

    Let me know if you’d like a step-by-step guide for any of these approaches!

    Hafiz

    Hi @emipg

    The error message “There has been a critical error on this website” usually indicates a PHP issue or a conflict in your WordPress site. Since it occurs only on /tag and /category URLs, this suggests a potential problem related to taxonomy templates, permalinks, or a plugin conflict.

    Here are the steps to troubleshoot and resolve this issue:

    Even though debugging isn’t showing anything relevant, ensure proper setup to capture more details.

    1. Enable Debugging for More Information

    Add these lines to your wp-config.php file to log errors:

    • define( 'WP_DEBUG', true );
    • define( 'WP_DEBUG_LOG', true );
    • define( 'WP_DEBUG_DISPLAY', false ); // Errors will not show on the website but will be logged.
    • Check the debug log in wp-content/debug.log after triggering the error.

    2. Check Permalink Settings

    Sometimes permalink issues can cause errors.

    • Go to Settings > Permalinks in the WordPress admin.
    • Without changing anything, click Save Changes to flush rewrite rules.
    • Test if /tag and /category URLs work now.

    3. Verify Theme Files

    The error could stem from your theme’s taxonomy-related template files.

    • Check for the following files in your theme:
      • category.php
      • tag.php
      • archive.php
    • Temporarily switch to a default WordPress theme like Twenty Twenty-Three. If the error disappears, the issue is in your theme’s taxonomy template files.

    Fix:

    • Open the problematic template file(s) and look for any PHP errors or incorrect function calls.
    • Test by removing or commenting out custom code in those files.

    4. Disable Plugins Temporarily

    The issue might be caused by a plugin, especially if it modifies taxonomies or permalinks.

    • Deactivate all plugins.
    • Check if /tag and /category URLs work.
    • Reactivate plugins one by one, testing the URLs after each activation to identify the culprit.

    5. Check for Memory Limit Issues

    If your site runs out of memory while processing these URLs, it can lead to intermittent errors.

    • Increase the PHP memory limit by adding this to wp-config.php:
      • define( 'WP_MEMORY_LIMIT', '256M' );

    6. Inspect Custom Taxonomies

    If your site uses custom taxonomies, ensure they are registered correctly.

    • Check your theme’s functions.php file or any plugin that registers custom taxonomies.
    • Look for potential issues like missing labels, improper rewrite rules, or conflicts.

    7. Check Error Logs at the Server Level

    If WordPress debugging doesn’t provide insights, check your server’s error logs.

    • Access logs via your hosting control panel or contact your hosting support for help.
    • Look for PHP errors, such as:
      • Fatal errors
      • Memory exhaustion
      • Syntax issues

    8. Update WordPress, Theme, and Plugins

    Outdated software can cause compatibility issues.

    • Ensure WordPress, your theme, and all plugins are updated to their latest versions.
    • If you suspect a recent update caused the issue, roll back temporarily using a plugin like WP Rollback.

    9. Check for Conflicts with SEO Plugins

    If you’re using an SEO plugin (like Yoast SEO), it might be causing the issue with taxonomy URLs.

    • Temporarily disable the SEO plugin.
    • Check /tag and /category URLs again.

    Fix: If confirmed, review the plugin’s taxonomy-related settings under its configuration.

    10. Reinstall Core WordPress Files

    If none of the above works, some core WordPress files might be corrupted.

    • Reinstall WordPress core files by going to Dashboard > Updates and clicking “Reinstall Now.”

    11. Restore Default .htaccess File

    If the site uses pretty permalinks, an issue with .htaccess can cause these errors.

    • Backup your current .htaccess file.
    • Replace its content with the default:
      • #BEGIN WordPress
      • RewriteEngine On
      • RewriteBase /
      • RewriteRule ^index.php$ – [L]
      • RewriteCond %{REQUEST_FILENAME} !-f
      • RewriteCond %{REQUEST_FILENAME} !-d
      • RewriteRule . /index.php [L]
      • #END WordPress

    12. Contact Hosting Support

    If you still can’t pinpoint the issue, your hosting provider might have deeper insights based on server-side logs and configurations.

    Let me know if you need further clarification or assistance with any step!

    Hafiz

    • This reply was modified 3 days, 16 hours ago by Dr. Hafiz Adnan.
    • This reply was modified 3 days, 14 hours ago by Yui.

    Hi @p2pleon,

    Option 1: Independent WordPress Installations

    1. Set Up Separate WordPress Instances
      Install WordPress separately on both example.com and subdomain.domain.com.
    2. Use Different Themes/Content
      Configure separate themes, plugins, and content for each site, making them distinct.
    3. Database Setup
      Ensure each WordPress installation uses a separate database. You can set this up during installation by providing a unique database name.
    4. File System
      Each site should have its own directory on the server. For example:
      • example.com -> /public_html/
      • subdomain.domain.com -> /public_html/subdomain/

    Option 2: WordPress Multisite

    If you want to manage both sites under one WordPress installation:

    1. Enable Multisite
      Update the wp-config.php file in your root WordPress installation: define('WP_ALLOW_MULTISITE', true);
    2. Set Up the Network
      After enabling multisite, go to Tools > Network Setup in your WordPress dashboard and configure the network for subdomains.
    3. Create Subdomain Site
      Once the network is set up, create a new site under My Sites > Network Admin > Sites. Assign it to subdomain.domain.com.
    4. Customize Each Site
      Each site in a multisite network can have its own theme, plugins, and content, making them distinct.

    If the information I provided helps you resolve your issue, please mark the topic as resolved.

    Thanks,

    Hafiz

    Hi Dave,

    The “Delivery Pickup Date & Time” plugin for WooCommerce offers features to set quantity limits for specific dates and days. This functionality allows you to control the number of items available for delivery or pickup on any given day. For instance, you can set an overall quantity limit on a specific date or establish day-specific quantity limits for both pickup and delivery.

    However, if you’re looking for a plugin that verifies the quantity of a specific product against a daily limit during the customer’s date selection process, the “Order Delivery Date Pro for WooCommerce” by Tyche Softwares might be more suitable. This plugin enables you to set maximum delivery limits based on per-product quantities. For example, if you can deliver only a certain number of a specific product per day, the plugin will prevent customers from selecting a delivery date that exceeds this limit. If a customer attempts to order more than the available quantity for a selected date, they will receive an error message prompting them to choose another date.

    In summary, while the “Delivery Pickup Date & Time” plugin offers general quantity limit features, the “Order Delivery Date Pro for WooCommerce” provides more granular control over product-specific daily quantity limits, aligning closely with your requirements.

    I hope it helps, and if you need more help, please let us know.

    Hafiz

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