add_link(): int|WP_Error

Adds a link using values provided in $_POST.

Return

int|WP_Error Value 0 or WP_Error on failure. The link ID on success.

Source

function add_link() {
	return edit_link();
}

Changelog

VersionDescription
2.0.0Introduced.

User Contributed Notes

  1. Skip to note 2 content

    add_link() : int|WP_Error This is a return-type declaration. It indicates that the add_link() function is expected to return either an integer or a WP_Error predefined object.

    Function add_link() This is an implementation function. Inside this function, another function named edit_linik() is called.

    And finally, the return edit_link() function is called. Its return value is immediately returned by the add_link() function.

    In details, the add_link() function serves as a wrapper around the edit_link() function. The return type declaration specifies that the expected output of this function is either an integer or a WP_Error object. It suggests that the function is designed to handle either a successful integer result or an error condition represented by a WP_Error object, providing flexibility for error handling in the calling code. The specific details of what edit_link() does are not provided here, as it would depend on its implementation elsewhere in the codebase.

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