How to get the image url in the input box from media library?
I have solved this by changing wp.media.editor.open() to meta_image_frame.open(). It’s now working fine. But I am not sure what was the error before.
I have solved this by changing wp.media.editor.open() to meta_image_frame.open(). It’s now working fine. But I am not sure what was the error before.
(0. Retrieve the meta value with get_post_custom (in order to highlight the selected value in the select input).) Query posts with get_posts( array( ‘post_type’ => ‘services’, ‘post_status’ => ‘publish’ ) ) Loop through the results with foreach and build your select input. Hook into save_post (add_action(‘save_post’, ‘my_save_meta’) to store the selected value (with update_post_meta).
Example code in add_meta_box() documentation uses save_post hook (at the very end of wp_insert_post() function) to add custom fields data from metabox. You must be using something like that already in your metaboxes, is it not appropriate place to validate your data?..
You are probably looking for the user_exists function. http://codex.wordpress.org/Function_Reference/email_exists This function will check whether or not a given email address ($email) has already been registered to a username, and returns that users ID (or false if none exists). If the email address does not exist (user_exists returns false), you may want to use the wp_create_user … Read more
You should avoid creating more tables. Just do it if you really have a good reason to. Note that wp_postmeta can store practically any kind of data, and simply using the get_post_meta function can do all the job in most cases. But if you must use another table, and taking it generally, then you’re looking … Read more
your function never defines a value for that field so when you check if its equal to 1 you never get true. try this: add_action( ‘show_user_profile’, ‘module_user_profile_fields’ ); add_action( ‘edit_user_profile’, ‘module_user_profile_fields’ ); function module_user_profile_fields( $user ) { ?> <h3>Module Options</h3> <table class=”form-table”> <tr> <th><label for=”module_activation”>Module Activation</label></th> <td> <input id=”module_activation” name=”module_activation” type=”checkbox” value=”1″ <?php if ( … Read more
Yes. it’s possible. Attachment file contents are taken by wp_mail call. Use $_FILES[‘file’][‘tmp_name’] for filename
For integers KSES has no special function. Use (int) or intval() or absint() See more: Data Validation – Integers
meta_input is just a single-dimension array as key => value: ‘meta_input’ => array( ‘name’ => $post[‘name’], ‘city’ => $post[‘city’] ) tax_input is slightly different, with tax as key and an array of values: ‘tax_input’ => array( ‘taxonomy_name’ => array( ‘term’, ‘term2’, ‘term3’ ) ) Note that for tax_input to work, the user currently logged in … Read more
You can clear the input field by using $(‘#shares’).val(”);