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::display_memory_notice( array $notice_data )

Register memory notice with Astra_Notices system


Description


Parameters

$notice_data

(array) (Required) Array containing memory data and notice type.


Source

File: inc/class-astra-memory-limit-notice.php

	private function display_memory_notice( $notice_data ) {
		$limit             = isset( $notice_data['memory_limit'] ) ? $notice_data['memory_limit'] : 0;
		$recommended_limit = $this->get_recommended_memory_limit( $limit );

		$message  = '<div>';
		$message .= '<p><strong>' . esc_html__( '🔔 PHP Memory Limit Notice', 'astra' ) . '</strong></p>';
		$message .= '<p>' . esc_html__( 'Your site is nearing its PHP memory limit, which may affect stability.', 'astra' ) . '</p>';
		$message .= '<p>' . sprintf(
			esc_html__( 'We recommend increasing it to at least %s for best performance.', 'astra' ),
			'<strong>' . esc_html( $recommended_limit ) . '</strong>'
		) . '</p>';
		$message .= '<p><a href="https://wpastra.com/docs/system-requirement-for-astra-theme/" target="_blank" rel="noopener">';
		$message .= esc_html__( 'Learn how to increase your PHP memory', 'astra' ) . '</a></p>';
		$message .= '</div>';

		$notice_args = array(
			'id'                    => 'astra-memory-limit-warning',
			'type'                  => 'warning',
			'message'               => $message,
			'show_if'               => true,
			'repeat-notice-after'   => false, // Don't repeat notice after a certain time.
			'is_dismissible'        => true,
			'capability'            => 'manage_options',
			'class'                 => 'astra-memory-notice',
		);

		Astra_Notices::add_notice( $notice_args );
	}


User Contributed Notes

You must log in before being able to contribute a note or feedback.