Trying to Update link_updated Column in wp_links (2 posts)

  1. plumwd
    Posted 5 years ago #

    Currently working on an addon that will take a list of links and insert them into the database.

    I have tried setting link_updated in my array prior to sending the call to insert or update a new link, but link_updated never gets set. It always remains at its default value.

    I have confirmed that the date I'm trying to set is accurate and not null (and is in the correct format for the db ex: 2011-04-07 00:00:00).

    $linkdata = array(
      "link_url"=> $link, // varchar, the URL the link points to
      "link_name" => $title, // varchar, the title of the link
      "link_target" => '_blank', // varchar, the target element for the anchor tag
      "link_description" => $desc, //varchar a short description of the link
      "link_visible" => 'Y', // varchar, Y means visible, anything else means not
      "link_owner" 	=> '1', // integer, a user ID
      "link_updated" => $fullDate, // datetime, when the link was last updated
      "link_category" => $term_id // int, the term ID of the link category. if empty, uses default link category
    $link_id = wp_insert_link( $linkdata );  //insert or update our link

    Everything gets inserted or updated as expected, except for the date.


  2. Fumito MIZUNO
    Posted 4 years ago #

    wp_insert_link (defined in wp-admin/includes/bookmark.php) does not change the "link_updated" field.

    I first thought it was a defect on wp_insert_link, but not.

    In http://core.trac.wordpress.org/ticket/12263
    Ryan answers

    link_updated does not track local modifications. It tracks when whatever the link points to is updated via remote requests to pingomatic.

Topic Closed

This topic has been closed to new replies.

About this Topic