AnsPress::get_form( string $name )

Description #

Get specific AnsPress form.

Parameters #

  • $name
    string (Required) Name of form.

Changelog #

VersionDescription
4.2.0Fixed: Only variable references should be returned by reference.
4.1.0Introduced.

Source #

File: anspress-question-answer.php

		public function &get_form( $name ) {
			$name = preg_replace( '/^form_/i', '', $name );

			if ( $this->form_exists( $name ) ) {
				return $this->forms[ $name ];
			}

			throw new \Exception(
				sprintf(
					// translators: %s contains name of the form requested.
					esc_html__( 'Requested form: %s is not registered .', 'anspress-question-answer' ),
					esc_html( $name )
				)
			);
		}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment