get_bookmark example


function get_bookmark_field( $field$bookmark$context = 'display' ) {
    $bookmark = (int) $bookmark;
    $bookmark = get_bookmark( $bookmark );

    if ( is_wp_error( $bookmark ) ) {
        return $bookmark;
    }

    if ( ! is_object( $bookmark ) ) {
        return '';
    }

    if ( ! isset( $bookmark->$field ) ) {
        return '';
    }


/** * Displays the edit bookmark link. * * @since 2.7.0 * * @param int|stdClass $link Optional. Bookmark ID. Default is the ID of the current bookmark. * @return string|void The edit bookmark link URL. */
function get_edit_bookmark_link( $link = 0 ) {
    $link = get_bookmark( $link );

    if ( ! current_user_can( 'manage_links' ) ) {
        return;
    }

    $location = admin_url( 'link.php?action=edit&link_id=' ) . $link->link_id;

    /** * Filters the bookmark edit link. * * @since 2.7.0 * * @param string $location The edit link. * @param int $link_id Bookmark ID. */

function wp_ajax_delete_link() {
    $id = isset( $_POST['id'] ) ? (int) $_POST['id'] : 0;

    check_ajax_referer( "delete-bookmark_$id);

    if ( ! current_user_can( 'manage_links' ) ) {
        wp_die( -1 );
    }

    $link = get_bookmark( $id );
    if ( ! $link || is_wp_error( $link ) ) {
        wp_die( 1 );
    }

    if ( wp_delete_link( $id ) ) {
        wp_die( 1 );
    } else {
        wp_die( 0 );
    }
}


function get_link( $bookmark_id$output = OBJECT, $filter = 'raw' ) {
    _deprecated_function( __FUNCTION__, '2.1.0', 'get_bookmark()' );
    return get_bookmark($bookmark_id$output$filter);
}

/** * Checks and cleans a URL. * * A number of characters are removed from the URL. If the URL is for displaying * (the default behavior) ampersands are also replaced. The 'clean_url' filter * is applied to the returned cleaned URL. * * @since 1.2.0 * @deprecated 3.0.0 Use esc_url() * @see esc_url() * * @param string $url The URL to be cleaned. * @param array $protocols Optional. An array of acceptable protocols. * @param string $context Optional. How the URL will be used. Default is 'display'. * @return string The cleaned $url after the {@see 'clean_url'} filter is applied. */


/** * Retrieves link data based on its ID. * * @since 2.0.0 * * @param int|stdClass $link Link ID or object to retrieve. * @return object Link object for editing. */
function get_link_to_edit( $link ) {
    return get_bookmark( $link, OBJECT, 'edit' );
}

/** * Inserts a link into the database, or updates an existing link. * * Runs all the necessary sanitizing, provides default values if arguments are missing, * and finally saves the link. * * @since 2.0.0 * * @global wpdb $wpdb WordPress database abstraction object. * * @param array $linkdata { * Elements that make up the link to insert. * * @type int $link_id Optional. The ID of the existing link if updating. * @type string $link_url The URL the link points to. * @type string $link_name The title of the link. * @type string $link_image Optional. A URL of an image. * @type string $link_target Optional. The target element for the anchor tag. * @type string $link_description Optional. A short description of the link. * @type string $link_visible Optional. 'Y' means visible, anything else means not. * @type int $link_owner Optional. A user ID. * @type int $link_rating Optional. A rating for the link. * @type string $link_rel Optional. A relationship of the link to you. * @type string $link_notes Optional. An extended description of or notes on the link. * @type string $link_rss Optional. A URL of an associated RSS feed. * @type int $link_category Optional. The term ID of the link category. * If empty, uses default link category. * } * @param bool $wp_error Optional. Whether to return a WP_Error object on failure. Default false. * @return int|WP_Error Value 0 or WP_Error on failure. The link ID on success. */
Home | Imprint | This part of the site doesn't use cookies.