Skip to content

New Relic for WordPress

After New Relic is enabled on a WordPress environment:

  • It is enabled on 10% of total requests per WordPress environment. If needed, New Relic can be enabled on up to 50% of requests for an environment.
  • The New Relic agent is activated on both batch and web containers for WordPress environments; batch containers run WP-CLI commands and also run WordPress Cron events.
  • The New Relic agent is not installed on any other parts of VIP’s infrastructure (i.e., the VIP CDN or database containers).

New Relic’s documentation provides additional instructions for controlling which WordPress-specific metrics are sent to New Relic.

New Relic PHP API and SDK

New Relic maintains a suite of PHP functions which can be used to add data to transactions, name transactions, etc. Their documentations provides a Guide to using the PHP agent API. VIP uses this API to enhance the data provided by all VIP WordPress applications.

Custom PHP INI configuration is not offered for individual WordPress applications (sites) on VIP, but some of the configurations can be set in PHP at runtime using ini_set().

Separating apps out on a per-site basis for multisite

By default, New Relic monitoring data for all subsites on a WordPress multisite environments will be displayed together. To view New Relic monitoring data on a site-per-app basis, the newrelic_set_appname() function can be added to vip-config.php or to a file in client-mu-plugins.

For example:

if ( extension_loaded( 'newrelic' ) && defined( 'VIP_GO_APP_ENVIRONMENT' ) && 'production' === VIP_GO_APP_ENVIRONMENT ) {
	newrelic_set_appname( $_SERVER['HTTP_HOST'] );

Subsites that share the same root domain will require additional logic for newrelic_set_appname() to distinguish between them (e.g., if subsite ID 2 is and subsite ID 3 is

To do this, a version of the following code example should be added to a file in client-mu-plugins (not in vip-config.php):

add_action( 'init', 'my_new_relic_appname', -1 );
 * Set application name for New Relic.
 * This is because we want to keep the main site appname the same as before so all data/reports are in the same place.
 * Ensure PHP agent is available and only when not the main site. 
function my_new_relic_appname() {
	if ( extension_loaded( 'newrelic' ) &&
		defined( 'VIP_GO_APP_ENVIRONMENT' ) &&
		'production' === VIP_GO_APP_ENVIRONMENT &&
		! is_main_site()
	) {
		$parsed_site_url = wp_parse_url( site_url() );
		$path            = $parsed_site_url['path'] ?? '';
		newrelic_set_appname( $_SERVER['HTTP_HOST'] . $path );

Enabling New Relic browser monitoring

By default, New Relic browser monitoring is disabled on new VIP Platform environments.

Browser monitoring in New Relic One measures the speed and performance of end users as they navigate to a site from different web browsers, devices, operating systems, and networks.

To enable New Relic browser monitoring, New Relic must be enabled on the environment and the newrelic_disable_autorum() function found in vip-config.php must be either removed or commented out:

if ( function_exists( 'newrelic_disable_autorum' ) ) {

Last updated: May 18, 2022