Undefined function astro_get_option() in WordPress Astro theme
Symptoms
Section titled “Symptoms”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.phpTo 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.
Switching to a Default Theme
Section titled “Switching to a Default Theme”Using WP-CLI
Section titled “Using WP-CLI”If you have WP-CLI access, you can switch to a default theme by running the following command:
wp theme activate twentytwentyfourUsing cPanel File Manager
Section titled “Using cPanel File Manager”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.
-
Log in to your cPanel account.
-
Navigate to the File Manager.
-
Locate the
wp-config.phpfile in your WordPress installation directory. -
Edit the file and add the following line:
define('WP_DEFAULT_THEME', 'twentytwentyfour'); -
Save the file and refresh your WordPress admin page.
-
Complete your cleanup by reinstalling the missing Astro plugins.
-
Remove the
WP_DEFAULT_THEMEdefinition fromwp-config.phpto restore the Astro theme.
Using phpMyAdmin
Section titled “Using phpMyAdmin”If you have phpMyAdmin access, you can switch to a default theme by editing the wp_options table in your WordPress database.
- Log in to your phpMyAdmin account.
- Select your WordPress database.
- Locate the
wp_optionstable. - Find the row with the
option_nameoftemplateand change theoption_valuetotwentytwentyfour. - Find the row with the
option_nameofstylesheetand change theoption_valuetotwentytwentyfour. - Find the row with the
option_nameofcurrent_themeand change theoption_valuetotwentytwentyfour. - Save the changes and refresh your WordPress admin page.
Using MySQL Command Line
Section titled “Using MySQL Command Line”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