Skip to content

Undefined function astro_get_option() in WordPress Astro theme

You may encounter a case where you are using the WordPress Astro theme and remove a required Astro plugin, resulting in an inability to access the wp-admin. The error message may contain the following:

PHP Fatal error: Uncaught Error: Call to undefined function astra_get_option() in /home/baruna/public_html/wp-content/themes/astra/inc/theme-update/class-astra-pb-compatibility.php

To fix the issue, you can restore the missing plugins using Acronis, or, as an alternative, switch to a default WordPress theme to regain access to your WordPress admin and reinstall the missing Astro plugins.

If you have WP-CLI access, you can switch to a default theme by running the following command:

Terminal window
wp theme activate twentytwentyfour

If you don’t have WP-CLI access, you can switch to a default theme by editing the wp-config.php file in your WordPress installation directory.

  1. Log in to your cPanel account.

  2. Navigate to the File Manager.

  3. Locate the wp-config.php file in your WordPress installation directory.

  4. Edit the file and add the following line:

    define('WP_DEFAULT_THEME', 'twentytwentyfour');
  5. Save the file and refresh your WordPress admin page.

  6. Complete your cleanup by reinstalling the missing Astro plugins.

  7. Remove the WP_DEFAULT_THEME definition from wp-config.php to restore the Astro theme.

If you have phpMyAdmin access, you can switch to a default theme by editing the wp_options table in your WordPress database.

  1. Log in to your phpMyAdmin account.
  2. Select your WordPress database.
  3. Locate the wp_options table.
  4. Find the row with the option_name of template and change the option_value to twentytwentyfour.
  5. Find the row with the option_name of stylesheet and change the option_value to twentytwentyfour.
  6. Find the row with the option_name of current_theme and change the option_value to twentytwentyfour.
  7. Save the changes and refresh your WordPress admin page.

If you have MySQL command line access, you can switch to a default theme by running the following commands:

USE your_database_name;
UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'template';
UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'stylesheet';
UPDATE wp_options SET option_value = 'twentytwentyfour' WHERE option_name = 'current_theme';

Moving your WordPress site?

Free Managed Migrations • WordPress Optimized Hosting

See WordPress Plans