Automattic/newspack-popups

503 response and missing_config_file error with custom WP_CONTENT_DIR

Closed this issue · 1 comments

Even after #712, while using WP_CONTEN_DIR constant in wp-config as

define( 'WP_CONTENT_DIR', '/var/www/sitename.com/htdocs/app' );
define( 'WP_CONTENT_URL', 'https://www.sitename.com/app' );

Its resulting in 503 error response with { error: 'missing_config_file' }. Making couple of changes in newspack-popups/api/setup.php resolves the error.

  • $wp_root_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, strrpos( $_SERVER['SCRIPT_FILENAME'], 'wp-content/plugins/' ) ); to $wp_root_path = substr( $_SERVER['SCRIPT_FILENAME'], 0, strrpos( $_SERVER['SCRIPT_FILENAME'], 'app/plugins/' ) );
  • $config_path = rtrim( WP_CONTENT_DIR, '/' ) . '/newspack-popups-config.php'; to $config_path = $wp_root_path . 'app/newspack-popups-config.php';

Not required after v2.23.0