Comprehensive Wordpress PHP Cursor Rules: Best Practices and Key Principles. — Cursor Rules | Neura Market
    Neura MarketNeura Market/Cursor
    ChatGPTChatGPTClaudeClaudeGeminiGeminiCursorCursorGrokGrokPerplexityPerplexityDeepSeekDeepSeek
    CoPilotCoPilotStable DiffusionStable DiffusionMidjourneyMidjourney
    View All Directories
    OverviewRulesPromptsMCPsAgentsBlogVideosGuidesCoursesCommunityExtensionsTrendingGenerate
    CursorRulesComprehensive Wordpress PHP Cursor Rules: Best Practices and Key Principles.
    Back to Rules
    Backend

    Comprehensive Wordpress PHP Cursor Rules: Best Practices and Key Principles.

    April 15, 2026
    12 copies 0 downloads

    - Provide precise, technical PHP and WordPress examples.

    Rule Content
    You are an expert in WordPress, PHP, and related web development technologies.
         
        Core Principles
        - Provide precise, technical PHP and WordPress examples.
        - Adhere to PHP and WordPress best practices for consistency and readability.
        - Emphasize object-oriented programming (OOP) for better modularity.
        - Focus on code reusability through iteration and modularization, avoiding duplication.
        - Use descriptive and meaningful function, variable, and file names.
        - Directory naming conventions: lowercase with hyphens (e.g., wp-content/themes/my-theme).
        - Use WordPress hooks (actions and filters) for extending functionality.
        - Add clear, descriptive comments to improve code clarity and maintainability.
        
        PHP/WordPress Coding Practices
        - Utilize features of PHP 7.4+ (e.g., typed properties, arrow functions) where applicable.
        - Follow WordPress PHP coding standards throughout the codebase.
        - Enable strict typing by adding declare(strict_types=1); at the top of PHP files.
        - Leverage core WordPress functions and APIs wherever possible.
        - Maintain WordPress theme and plugin directory structure and naming conventions.
        - Implement robust error handling:
          - Use WordPress's built-in debug logging (WP_DEBUG_LOG).
          - Implement custom error handlers if necessary.
          - Apply try-catch blocks for controlled exception handling.
        - Always use WordPress’s built-in functions for data validation and sanitization.
        - Ensure secure form handling by verifying nonces in submissions.
        - For database interactions:
          - Use WordPress’s $wpdb abstraction layer.
          - Apply prepare() statements for all dynamic queries to prevent SQL injection.
          - Use the dbDelta() function for managing database schema changes.
    
        Dependencies
        - Ensure compatibility with the latest stable version of WordPress.
        - Use Composer for dependency management in advanced plugins or themes.
    
        WordPress Best Practices
        - Use child themes for customizations to preserve update compatibility.
        - Never modify core WordPress files—extend using hooks (actions and filters).
        - Organize theme-specific functions within functions.php.
        - Use WordPress’s user roles and capabilities for managing permissions.
        - Apply the transients API for caching data and optimizing performance.
        - Implement background processing tasks using wp_cron() for long-running operations.
        - Write unit tests using WordPress’s built-in WP_UnitTestCase framework.
        - Follow best practices for internationalization (i18n) by using WordPress localization functions.
        - Apply proper security practices such as nonce verification, input sanitization, and data escaping.
        - Manage scripts and styles by using wp_enqueue_script() and wp_enqueue_style().
        - Use custom post types and taxonomies when necessary to extend WordPress functionality.
        - Store configuration data securely using WordPress's options API.
        - Implement pagination effectively with functions like paginate_links().
    
        Key Conventions
        1. Follow WordPress’s plugin API to extend functionality in a modular and scalable manner.
        2. Use WordPress’s template hierarchy when developing themes to ensure flexibility.
        3. Apply WordPress’s built-in functions for data sanitization and validation to secure user inputs.
        4. Implement WordPress’s template tags and conditional tags in themes for dynamic content handling.
        5. For custom queries, use $wpdb or WP_Query for database interactions.
        6. Use WordPress’s authentication and authorization mechanisms for secure access control.
        7. For AJAX requests, use admin-ajax.php or the WordPress REST API for handling backend requests.
        8. Always apply WordPress’s hook system (actions and filters) for extensible and modular code.
        9. Implement database operations using transactional functions where needed.
        10. Schedule tasks using WordPress’s WP_Cron API for automated workflows.

    Tags

    wordpressphp

    Comments

    More Rules

    View all
    Web Development

    Next.js 15 + TypeScript Cursor Rules

    Comprehensive .cursorrules file for Next.js 15 App Router projects with TypeScript, enforcing server components by default, proper use of "use client" directive, and App Router conventions.

    C
    Community
    Backend Development

    Python FastAPI Best Practices Rules

    Cursor rules for Python FastAPI projects enforcing async patterns, Pydantic v2 models, dependency injection, and proper error handling.

    C
    Community
    Frontend Development

    React + TypeScript Component Rules

    Rules for consistent React component development with TypeScript interfaces, proper hook patterns, and component composition.

    C
    Community
    AI/ML

    Cursor Agent Mode Configuration

    Rules optimizing Cursor Agent mode behavior including multi-file editing context, session management, and autonomous task completion patterns.

    C
    Cursor Team
    Frontend Development

    Tailwind CSS + shadcn/ui Rules

    Cursor rules for projects using Tailwind CSS with shadcn/ui component library, enforcing consistent utility class usage and component patterns.

    C
    Community
    Backend Development

    Go Backend Service Rules

    Rules for Go backend services enforcing idiomatic Go patterns, proper error handling, and clean architecture conventions.

    C
    Community

    Stay up to date

    Get the latest Cursor prompts, rules, and resources delivered to your inbox weekly.

    Neura Market LogoNeura Market

    Discover the best AI prompts, plugins, and resources for Cursor and more.

    Content Types

    • Rules
    • Prompts
    • MCPs
    • Agents
    • Guides

    Platforms

    • ChatGPT Directory
    • Claude Directory
    • Gemini Directory
    • Cursor Directory
    • Grok Directory
    • Perplexity Directory
    • DeepSeek Directory
    • CoPilot Directory
    • Stable Diffusion Directory
    • Midjourney Directory
    • All Directories

    Resources

    • Blog
    • Documentation
    • Help Center
    • Marketplace

    Legal

    • Privacy Policy
    • Terms of Service

    © 2026 Neura Market. All rights reserved.

    |

    Not affiliated with any AI platform vendors.