コード例 #1
0
/**
 * Delete the old one-key-per-flag metadata that older versions of the plugin
 * used to store per-post settings.
 *
 * @param int $post_id
 */
function rawhtml_delete_old_post_settings($post_id)
{
    $fields = rawhtml_get_settings_fields();
    foreach ($fields as $field) {
        delete_post_meta($post_id, $field);
    }
    foreach ($fields as $field) {
        delete_post_meta($post_id, '_' . $field);
    }
}
コード例 #2
0
ファイル: wp-snippets.php プロジェクト: Ryan4021/wp-snippets
 /**
  * Filters Raw HTML plugin settings for a specific post.
  *
  * @param mixed   $what_wp_says Current post meta value.
  * @param integer $post_id Post ID.
  * @param string  $meta_key Post meta key.
  * @param boolean $single Return a single value?
  *
  * @return mixed Post meta value after having been filtered by this routine.
  */
 public static function raw_html_settings($what_wp_says, $post_id, $meta_key, $single)
 {
     if (function_exists('rawhtml_get_settings_fields')) {
         if ($meta_key === '_rawhtml_settings' && get_post_type($post_id) === 'snippet') {
             $settings = implode(',', array_fill(0, count(rawhtml_get_settings_fields()), '0'));
             return $single ? $settings : array($settings);
         }
     }
     return $what_wp_says;
     // Default return value.
 }