edit_link example

if ( add_link() ) {
            $redir = add_query_arg( 'added', 'true', $redir );
        }

        wp_redirect( $redir );
        exit;

    case 'save':
        $link_id = (int) $_POST['link_id'];
        check_admin_referer( 'update-bookmark_' . $link_id );

        edit_link( $link_id );

        wp_redirect( $this_file );
        exit;

    case 'delete':
        $link_id = (int) $_GET['link_id'];
        check_admin_referer( 'delete-bookmark_' . $link_id );

        wp_delete_link( $link_id );

        wp_redirect( $this_file );
        


/** * Adds a link using values provided in $_POST. * * @since 2.0.0 * * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. */
function add_link() {
    return edit_link();
}

/** * Updates or inserts a link using values provided in $_POST. * * @since 2.0.0 * * @param int $link_id Optional. ID of the link to edit. Default 0. * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. */
function edit_link( $link_id = 0 ) {
    
Home | Imprint | This part of the site doesn't use cookies.