Skip to content
WP Cloud
WP Cloud
    • For Hosts
    • For Agencies
    • For Registrars
    • For Native Hosting
    • Performance
    • Security
    • Real-Time Automated Failover
    • Vertical Scaling and Bursting
    • WordPress Management
    • PanelAlpha Integration: White-Label WordPress Control Panel for Hosts
    • EasyEngine Panel Integration: Visual WordPress Management for WP Cloud
    • FAQs
    • WP Cloud API
    • Partner Portal
    • Documentation
    • New Partner Guide
    • Pressable
    • Convesio
    • Porkbun
    • PanelAlpha
    • Ivapix
    • UNC Greensboro
    • Impressive Hosting
    • Blog
    • Performance Benchmarks
  • Connect With Us
  • Login ↗
Start Here ↗
  • Solutions

    • For Hosts
    • For Agencies
    • For Registrars
    • For Native Hosting
    • Featured Partners

    Features

    • Performance
    • Security
    • Real-Time Automated Failover
    • Vertical Scaling and Bursting
    • WordPress Management

    Integrations

    • PanelAlpha Integration
    • Easy Engine Panel Integration

    Resources

    • FAQs
    • WP Cloud API
    • Partner Portal
    • Documentation
    • New Partner Guide
  • Case Studies
    • PressableA case study about how WP Cloud supports Pressable to power millions of page views daily.
    • Convesio
    • Porkbun
    • PanelAlpha
    • Ivapix
    • UNC Greensboro
    • Newspack
    • Inverse Paradox
  • Insights
    • Podcast
    • BlogWP Cloud blog page with latest news and updates about the platform.
    • Performance Benchmarks
  • Connect With Us
  • Login ↗
Start Here ↗

Browse

    • WP Cloud platform overview
    • Onboard and launch with WP Cloud
    • WP Cloud Partner Portal
    • Get support from WP Cloud
    • WP Cloud glossary
    • Manage and secure API keys
    • Client SSH
    • WP Cloud API quick start
    • Webhooks
    • Run bulk tasks across sites
      • Manage site domains and aliases
      • Domain verification records
      • TLS certificates
      • Manage custom TLS certificates
      • Cloudflare and WP Cloud
    • Clone a site
    • Configure resources, site type, and billing with site meta
    • Delete a site
    • Persistent data
    • Staging sites
    • Migrate a site to WP Cloud
      • SSH and SFTP access models
      • Client SSH
      • User SSH and SFTP access
      • Database credentials
      • phpMyAdmin
      • ABSPATH
      • Default wp-config.php
      • Site constants
      • Configure redirects and headers with custom-redirects.php
      • Akismet and Jetpack
      • Blocked and unsupported plugins
      • PHP lifecycle and supported versions
      • Symlinks and managed software
      • WordPress versions
      • Install Composer and WP-CLI packages
      • Manage platform software with WP-CLI
      • Useful WP-CLI commands
    • Transactional email
    • WordPress multisite
    • Cron scheduling
    • Decoupled and headless WordPress
    • Repair Yoast indexables
      • Page Cache
      • Edge Cache
      • Object Cache
      • Image transformation
      • Offload image sub-sizes
    • Configure lightweight 404s for static files
      • DDoS protection
      • Defensive Mode
      • Rate limiting
      • Network and web application firewalls
      • Bot protection
      • Password protection
      • HTTP and security headers
      • PHP filesystem access permissions
      • Scan a site for malware
    • Backups overview
    • Create an on-demand backup
    • Restore a backup
    • Jetpack backups
      • Error logs
      • Web server logs
    • Metrics
    • Application performance monitoring
    • Automated failover
    • IP ranges
    • Origin and edge servers
    • Server specifications and settings
    • EasyEngine integration
    • PanelAlpha integration
      • White labelling and co-marketing WP Cloud
      • WP Cloud logos
      • Terms of Service & Compliance
      • Prohibited content
      • Copyright infringement and takedown notifications
    • WP Cloud billing
    • WP Cloud for agencies and site networks
    • WP Cloud partner support options
    • Troubleshoot Page and Edge Cache
    • Troubleshoot HTTP 429 and 599 errors
    • WP Cloud HTTP status codes
    • Troubleshoot site performance
    • Cache slow database queries
    • Troubleshoot duplicate core files, wp-config.php, and wp-admin 403 errors
    • Troubleshoot email delivery
    • Troubleshoot PDF thumbnail generation
    • Troubleshoot TLS certificate provisioning
Documentation/WordPress on WP Cloud/WordPress configuration/ABSPATH

ABSPATH

LAST UPDATED

3 months ago

    WordPress core is symlinked to platform-managed files on WP Cloud. As a result, ABSPATH points to the managed WordPress directory rather than the site’s writable htdocs directory. Plugins and themes that use ABSPATH to locate files under wp-content can therefore build the wrong path.

    Understand the WP Cloud path

    The following test shows where ABSPATH points:

    <?php var_dump( ABSPATH );Code language: HTML, XML (xml)

    On a WP Cloud site, it returns:

    string(19) "/srv/htdocs/__wp__/"Code language: JavaScript (javascript)

    The __wp__ directory is the symlinked WordPress core location. Use ABSPATH when code needs a WordPress core path, but not to find a plugin, theme, upload, or other file under wp-content.

    This means the constant’s value is valid, but its meaning differs from the site-root assumption made by some portable WordPress code.

    Use WP_CONTENT_DIR for site-owned files

    This path is incorrect on WP Cloud because it assumes wp-content is inside the managed core directory:

    $target_path = ABSPATH . 'wp-content/plugins/order-tracking/order-sheets/';Code language: PHP (php)

    Build the path from WP_CONTENT_DIR instead:

    $target_path = WP_CONTENT_DIR . '/plugins/order-tracking/order-sheets/';Code language: PHP (php)

    ABSPATH includes a trailing slash; WP_CONTENT_DIR does not. Include the separator when appending a path to WP_CONTENT_DIR.

    Define a portable site-root constant

    Code that needs the site root rather than wp-content can define its own constant from WP_CONTENT_DIR:

    define( 'EXAMPLE_SITE_ROOT', str_replace( 'wp-content', '', WP_CONTENT_DIR ) );Code language: JavaScript (javascript)

    On WP Cloud, EXAMPLE_SITE_ROOT resolves to /srv/htdocs/. It can then be used without depending on WP Cloud’s symlinked core path:

    $target_path = EXAMPLE_SITE_ROOT . 'wp-content/plugins/order-tracking/order-sheets/';Code language: PHP (php)

    The WordPress filesystem reference and WP_Filesystem_Base::wp_content_dir() provide additional options for code that works with the WordPress filesystem.

    Previous phpMyAdmin
    Next Default wp-config.php

    Related Guides

    • Default wp-config.php

      Recreate the default WP Cloud wp-config.php structure without replacing managed database settings.

      1 Min.

      READ

    • Site constants

      Use WP Cloud PHP constants to identify the platform, Atomic Site ID, and host client…

      1 Min.

      READ

    • Configure redirects and headers with custom-redirects.php

      Add early PHP redirects, response headers, and narrow access rules with custom-redirects.php.

      2 Min.

      READ

    On this page

      Contact support

      Contact us with Support issues and questions related to WP Cloud, the WP Cloud Atomic API, API-key IP allow list changes, Station, and more.

      Check the FAQs

      Have questions? Please visit our FAQ to learn more.

      An Automattic venture

      Work With Us

      Press

      Privacy Policy

      © 2021-2026 Automattic Inc.

      Notifications