Delete custom fields on post publish?
Delete custom fields on post publish?
Delete custom fields on post publish?
Quicktag button to automatically add a custom field to a post
you have to use “esc_attr” in case your value contains a quote for exemple <?php echo esc_attr(get_post_meta(…));?>
How to retrieve a post by inputing the url in a custom field and displaying it on an options page
In cases like this its better off (IHMO) to simple use a custom query using the $wpdb class ex: <?php global $wpdb; //first get a list of all meta keys $keys = $wpdb->get_col(“SELECT distinct meta_key FROM $wpdb->usermeta”); //then prepare the meta keys query as fields which we’ll join to the user table fields $meta_columns=””; foreach … Read more
You can use the get_post_types function to fetch and search through the registered post types up to that point (the init hook where you would normally register the custom post type). You can possibly use a later hook like wp_loaded to do this check before trying to register the post type in case some other … Read more
use here set type method: add_action(‘init’,’engineCreateRecurringSchedule’); add_action(‘engineRecurringCronJob’,’engineDaysToGoUpdate’); function engineDaysToGoUpdate(){ // Arguments to get published posts with ‘engine’ post type. $engineDaysToGoArgs = get_posts( array ( ‘post_status’ => ‘publish’ ‘posts_per_page’ => -1, ‘post_type’ => ‘engine’) ); // Calling the value of custom field. $engineDaysToGo = genesis_get_custom_field(‘wpcf-engine-days-to-go’); settype($engineDaysToGo, “integer”); // Subtracting 1 from the value. $updatedEngineDaysToGo = $engineDaysToGo–; … Read more
I figured it out myself thanks to this Q&A. The problem was with closures in loops. Can’t really explain what happens but it works for me. jQuery(document).ready(function($){ $.ajax({ url: ajaxurl, data: { ‘action’:’ajax_action’, ‘post_id’ : 18 }, success:function(data) { var hero = JSON.parse(data); function createCallback( i ){ return function(){ $(‘.changing’).html(hero[i][‘description’]); } } $(document).ready(function(){ for(var i … Read more
It should be stored in the wp_usermeta table under the entreprise and os user meta keys. You should consider using prefix on your custom meta keys, to avoid name collison. Example: kerzzy_entreprise kerzzy_os It should show up with: SELECT * FROM `wp_usermeta` WHERE `meta_key` = ‘entreprise’ in your MySQL administration tool, e.g. PHPMyAdmin. … and … Read more
Creating a user ‘add custom field’ section