WordPress is a publishing platform that makes it easy for anyone to publish online, and proudly powers millions of websites. It comes in two flavors: the fully hosted WordPress.com, and the self-hosted version available at WordPress.org. You can read more about the general differences between the two.
There are a few key differences to keep in mind when developing a theme or plugin for a WordPress.com site compared to how you might do it for self-hosted/WordPress.org sites. We’ve outlined a non-exhaustive list below.
WordPress.com provides full page caching, along with persistent object caching, out of the box. Anonymous page views are retrieved from memory for high performance and high scalability, and many db queries and other code-level objects are stored in-memory for fast retrieval. For more information, see our caching documentation.
WordPress.com has a custom comment form that allows visitors to leave comments as guests or using their WordPress.com, Facebook, or Twitter accounts. This comment form is also available for self-hosted sites via Jetpack.
Core WordPress.com features #
While WordPress.com is running on trunk WordPress, we’ve added a lot of bells and whistles in the form of features for every WordPress.com user and site owner. For more information about WordPress.com core features, take a read through the WordPress.com features category in the VIP Lobby and the WordPress.com features on the main WordPress.com Support site.
Custom Database Tables #
Custom database tables are not supported on WordPress.com. You should try to work within the WordPress API and use existing storage mechanisms like Custom Post Types, Taxonomies, Post Meta/Custom Fields, and so on.
Custom Fields Meta Box #
For security reasons, the “Custom Fields” meta box is disabled on WordPress.com. If your theme makes use of post meta, you should add custom meta boxes to allow users to enter data. The bonus is that this makes for a better user experience.
PHP File Whitelist #
WordPress.com has a PHP file whitelist, which restricts direct access to PHP files that are not core WordPress files. This means that PHP files in your theme cannot be accessed directly, which goes against best practices anyway.
Plugins on WordPress.com VIP are organized differently than a standard self-hosted/WordPress.org site, since on VIP your access is specific to your site’s theme folder. To use plugins on a WordPress.com VIP site, you add them to a “plugins” directory within your theme directory, and require_once/include_once them in
Registering Users #
By default, users registered through VIP-hosted websites are created as WordPress.com users and must go through the WordPress.com user registration process and agree to the WordPress.com terms of service. This means that the millions of users logged in to WordPress.com will also be logged in on your domain, making it easier for them to comment on your site. If you’d like to be able to register your own user profiles or create custom registration fields you’ll need to use a 3rd-party registration service, such as our partners at Janrain. Note that you can invite any existing WordPress.com user to join your site at any permitted user level.
Server-side Cookie Handling #
Because of full-page caching, cookies should not be accessed or manipulated server-side. Any cookie handling code should be done client-side.
For translations, WordPress.com uses the “default” textdomain and your theme should too.
All logged-in users will see the WordPress.com admin bar. This cannot be removed as it is integral to the user experience on WordPress.com.
URL Functions #
In your VIP theme and plugins,
home_url() always returns the custom domain as mapped in WordPress.com whereas
sute_url() returns the *.wordpress.com domain.
Admin-ajax on domain-mapped sites #
If your site uses a custom domain (and not just the default *.wordpress.com one) and your theme or plugin makes requests to admin-ajax.php, you’ll need to follow these instructions to make sure your requests are successful. This extra step is necessary because your site’s backend is served at a different domain than the front of your site.
Fetching remote data #
On WordPress.com VIP, we provide special cached functions for fetching external data, and require that you use these, rather than the normal WordPress.org functions. Full details on how to use these functions are here.
Storing user data #
User data storage works only slightly differently on WordPress.com VIP than on WordPress.org. The basic difference is that WordPress.org’s use of the
user_meta is replaced by
user_attributes. From a coding perspective the two behave exactly the same and and are set and accessed through the same functions. The one difference is that unique keys are required for
user_attributes. Full details are here.
Embedding Rich Media #
WordPress.com VIP takes particular care to protect your site and data from malicious code embedded in your site or content. When compared to WordPress.org, on WordPress.com VIP provides additional access to additional tools in the form of shortcodes and other protections that will keep you safe when you need to embed
script tags. Please read the full documentation on embedding content.
Custom fields #
The custom fields UI isn’t supported on WordPress.com. Please create your own custom meta boxes instead.