Note that there are some explanatory texts on larger screens.

plurals
  1. PO WPSC_UPDATE_META Function in PHP How too use it?
    primarykey
    data
    text
    <p>Someone that's familiar with this know how to use it? I can't find any documentation on this function anywhere. and can this be used to update say for example the weight field and changing it from the default of pounds to options?</p> <p>I assume the proper setup would be something like this, bu I've no idea what goes in type.</p> <pre><code>wpsc_update_meta($post_id, 'weight', '3', $type); wpsc_update_meta($post_id, 'weight_unit', 'ounce', $type); </code></pre> <p>Any ideas guys? The full function is listed below.</p> <pre><code>function wpsc_update_meta( $object_id = 0, $meta_key, $meta_value, $type, $global = false ) { global $wpdb; if ( !is_numeric( $object_id ) || empty( $object_id ) &amp;&amp; !$global ) { return false; } $cache_object_id = $object_id = (int) $object_id; $object_type = $type; $meta_key = wpsc_sanitize_meta_key( $meta_key ); $meta_tuple = compact( 'object_type', 'object_id', 'meta_key', 'meta_value', 'type' ); $meta_tuple = apply_filters( 'wpsc_update_meta', $meta_tuple ); extract( $meta_tuple, EXTR_OVERWRITE ); $meta_value = $_meta_value = maybe_serialize( $meta_value ); $meta_value = maybe_unserialize( $meta_value ); $cur = $wpdb-&gt;get_row( $wpdb-&gt;prepare( "SELECT * FROM `".WPSC_TABLE_META."` WHERE `object_type` = %s AND `object_id` = %d AND `meta_key` = %s", $object_type, $object_id, $meta_key ) ); if ( !$cur ) { $wpdb-&gt;insert( WPSC_TABLE_META, array( 'object_type' =&gt; $object_type, 'object_id' =&gt; $object_id, 'meta_key' =&gt; $meta_key, 'meta_value' =&gt; $_meta_value ) ); } elseif ( $cur-&gt;meta_value != $meta_value ) { $wpdb-&gt;update( WPSC_TABLE_META, array( 'meta_value' =&gt; $_meta_value), array( 'object_type' =&gt; $object_type, 'object_id' =&gt; $object_id, 'meta_key' =&gt; $meta_key ) ); } wp_cache_delete( $cache_object_id, $object_type ); if ( !$cur ) { return true; } } </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload