This function’s access is marked private. This means it is not intended for use by plugin or theme developers, only in other core functions. It is listed here for completeness.
Astra_Memory_Limit_Notice::get_site_health_actions( float $memory_percentage )
Get Site Health actions based on memory usage
Description
Parameters
- $memory_percentage
-
(float) (Required) Memory usage percentage.
Return
(string) Actions HTML.
Source
File: inc/class-astra-memory-limit-notice.php
private function get_site_health_actions( $memory_percentage ) { $actions = ''; if ( $memory_percentage >= $this->warning_threshold ) { $current_limit = $this->get_memory_limit_in_bytes(); $recommended_limit = $this->get_recommended_memory_limit( $current_limit ); $actions .= '<h4>' . __( 'How to increase PHP memory limit:', 'astra' ) . '</h4>'; $actions .= '<ol>'; $actions .= '<li><strong>' . __( 'Contact your hosting provider', 'astra' ) . '</strong><br>'; $actions .= sprintf( __( 'The easiest solution is to ask your hosting provider to increase your PHP memory limit to at least %s.', 'astra' ), $recommended_limit ) . '</li>'; $actions .= '<li><strong>' . __( 'Edit wp-config.php file', 'astra' ) . '</strong><br>'; $actions .= __( 'Add this line to your wp-config.php file (before the "/* That\'s all, stop editing!" line):', 'astra' ) . '<br>'; $actions .= '<code style="background: #f1f1f1; padding: 4px 8px; border-radius: 3px; font-family: monospace; color: #d63638;">define(\'WP_MEMORY_LIMIT\', \'' . esc_html( $recommended_limit ) . '\');</code></li>'; $actions .= '<li><strong>' . __( 'Edit .htaccess file', 'astra' ) . '</strong><br>'; $actions .= __( 'Add this line to your .htaccess file:', 'astra' ) . '<br>'; $actions .= '<code style="background: #f1f1f1; padding: 4px 8px; border-radius: 3px; font-family: monospace; color: #d63638;">php_value memory_limit ' . esc_html( $recommended_limit ) . '</code></li>'; $actions .= '<li><strong>' . __( 'Edit php.ini file', 'astra' ) . '</strong><br>'; $actions .= __( 'If you have access to php.ini, change this line:', 'astra' ) . '<br>'; $actions .= '<code style="background: #f1f1f1; padding: 4px 8px; border-radius: 3px; font-family: monospace; color: #d63638;">memory_limit = ' . esc_html( $recommended_limit ) . '</code></li>'; $actions .= '</ol>'; $actions .= '<p><strong>' . __( 'Recommended memory limits:', 'astra' ) . '</strong></p>'; $actions .= '<ul>'; $actions .= '<li>' . __( 'Basic WordPress site: 256MB', 'astra' ) . '</li>'; $actions .= '<li>' . __( 'Site with multiple plugins: 512MB', 'astra' ) . '</li>'; $actions .= '<li>' . __( 'WooCommerce or complex site: 1GB or higher', 'astra' ) . '</li>'; $actions .= '</ul>'; $actions .= '<p>'; $actions .= sprintf( __( 'For detailed instructions, visit our <a href="%s" target="_blank" rel="noopener">documentation on increasing PHP memory limit</a>.', 'astra' ), 'https://wpastra.com/docs/system-requirement-for-astra-theme/' ); $actions .= '</p>'; } else { $actions .= '<p>' . __( 'No action required. Your memory usage is within acceptable limits.', 'astra' ) . '</p>'; $actions .= '<p>' . __( 'Continue monitoring your memory usage, especially when installing new plugins or themes.', 'astra' ) . '</p>'; } return $actions; }
Expand full source code Collapse full source code View on Trac