Articles of save

Custom Post Type, Saving Multiple Checkboxes

For a custom post type, I’m pulling in a list of another custom post types that I need to select for saving … <input type=”checkbox” name=”32″> My CPT <br> <input type=”checkbox” name=”41″> My CPT 2 <br> <input type=”checkbox” name=”42″> My CPT 3 <br> <input type=”checkbox” name=”43″> My CPT 4 It’s easy enough to save a […]

How to disable saving/changing update date for certain admin users?

I have an admin user who is only for correcting the spelling errors and grammar stuff, however, when he corrects some post that is several hours or days old and just changes “People are gready” to “People are greedy” in the title or makes some other changes in the content, the update date is changed […]

How to add wechat (weixin) link to navigation menu?

The profile link of WeChat (or Weixin) has the following format: weixin://contacts/profile/username As you can see, it doesn’t use http:// and that seems to be the reason that it cannot be added to the WordPress navigation menu. Well you can add it, but after saving the menu, the URL field is blank (again). The strangest […]

Settings API erases itself?

I have two forms created using Settings API, and when I save one of them the other one gets erased and vice versa. Here’s the whole code so you could paste it into your functions.php file and see for yourself: // Register settings function registerSettings() { register_setting(‘XX_theme_settings’, ‘XX_theme_settings’ ); add_settings_section(‘theme_options’, ‘Theme Options’, ‘theme_options_generate’, ‘page1’ ); […]

$wpdb->replace / Replace or update primary key

I write code to save data in to the database table. I want Replace a row in a table if it exists or insert a new row in a table if the row did not already exist. I use $wpdb->replace function and then add $wpdb->insert_id to end of code. For Update all fields , […]

Why won't my custom widget stay in the sidebar after a reload?

After I drag my custom widget into a widget area and reload the page it’s gone. Any ideas? <?php add_action(‘widgets_init’,’register_postTypeWidget’); function register_postTypeWidget(){ register_widget(‘postType_widget’); } class postType_widget extends WP_Widget { function postType_widget() { $widget_ops = array( ‘classname’ => ‘postType_widget’, ‘description’ => __(‘Display Posts by Post Type’) ); $control_ops = array( ‘width’ => 300, ‘height’ => 350, […]

How to add multiple checkbox elements to media attachments?

Based on solved question from: How to add a checkbox element to attachments editor with example Theres an example of multiple Checkboxes, for example: Colors, patterns, etc… A grouped list but using checkboxes? Tips to save and remember checked options on edit? Thanks in advance.

how to save multiple custom fields for a post in one go?

I want to save multiple custom fields for a custom post in one go. Something like get_post_custom() except for that I need to set it this time.

Add comments meta fields to comments metabox on post edit screen

I have few custom fields in comment form. How can I add these fields to comments metabox? I divide my question on 3 parts: 1) How to remove url field and add custom comment fields to comment quick edit form? 2) How to add custom fields to comment add form? 3) Hot to add custom […]

Allow guests to save favourite pages?

We’re creating a site where we want guest users to add pages to a favourites list (post IDs), so they can print or email their selection if they want. What would the best way be to do this in WordPress? I think ajax but I’m not too sure how to save it in the WordPress […]