Articles of save

How to undo the last changes to a custom menu?

I have a wordpress site with a custom menu. When I want to add a page or something to the menu, I click appearance, add the item, then drag it to the right location. This time when I did it the menu only saved about 30% of what was originally there. Normally, I would be […]

Calling a save function from a “submit” button

I am trying to call a function to save changes from a submit button, but I am not accustomed to PHP programming, as I have just started. I tried Googling around a bit, but didn’t find anything too useful or applicable to my situation. At the bottom of my script, I have this function which […]

MetaBox not saving after empty

So I created a few custom metaboxes like this, and they all operate this way. They work perfectly the first time I put anything into them, and any time I edit them after that, but if they are emptied, they will no longer update. add_action( ‘admin_menu’, ‘TFP_meta’ ); add_action( ‘save_post’, ‘save_TFP_meta’, 10, 2 ); function […]

Adding action to save_post, post needs to be saved twice for function to work

I have written the following function which copies all post terms from the “tribe_events_cat” taxonomy to the “categoria” taxonomy when the post is saved. There is a bug where in order for the terms to be copied, I need to click “update” twice (i.e. save the post twice). I believe this happens because when I […]

Warning: Illegal string offset on theme options page

Im creating custom theme options and Im getting this PHP error: Warning: Illegal string offset in … on line 75 // adding the page to menu add_menu_page(‘Theme Options’, ‘Theme Options’, ‘manage_options’, ‘rm-options’, ‘rm_display_options_page’); // form to display options <form method=”post” action=”options.php”> <?php settings_fields(‘rm_theme_options’); // options name do_settings_sections(‘rm-options’); // page submit_button(); ?> </form> // adding a […]

Save meta box values as an array to wp_postmeta

I have a custom metabox running that dynamically adds fields to the form I’m stuck on the saving part. This is how the fields are added: <tr> <td valign=”top”> <label for=”brands” class=”prfx-row-title”><?php _e( ‘Merken:’, ‘prfx-textdomain’ )?></label> </td> <td> <script type=”text/javascript”> jQuery(document).ready(function($){ var max_fields = 10; //maximum input boxes allowed var wrapper = $(“.input_fields_brand”); //Fields wrapper […]

Add a wp editor to custom plugin and save data

I’m creating a custom plugin. One of the fields in the plugin let’s the user add data. If I add a textarea the user has no control over the text. So I would like to add a editor. I know WordPress offers the wp_editor(); function.After some Google-ing I found that it is very easy to […]

Show message from backend

I need to show messages on wordpress page editor, when a page is updated. I know there is a admin_notice hook to show messages. I have a save_post_page perfectly working on my code, but I need to know how to connect both of them and I don’t know why? Any help would be appreciate, Best […]

How to unpublish a page and still keep a draft?

I have a holiday sale page that no longer applies as the holidays have past. I want to keep the page for future design reference. I do not want the page to be accessible from the Internet. I tried: Setting the page status to Pending Review Setting the page status to Draft Neither of these […]

Change post title during post saving process

My theme and Qtranslate plugin have a conflict and cause many issues on my website’s post titles. I cannot trace what causes the issue and I thought that I could handle the title saving myself instead. I would like to be able to change post title that wordpress uses when saving a post from backend. […]