Articles of plugin options

Theme options are they necessary

So I have decided to use wordpress for a site. But just as I begun I realized that I might need options. Things as simple as logo, favicon and possibly some parallax settings. Is it necessary to have options or can I set the logo by just getting the uploads/images path and setting it to […]

Create a select metabox that the user can pupolate?

I have been working on a plugin that uses text area metaboxes on an options page to populate drop downs in the CPT area. I was with the help of some others able to get the list to show in the select boxes and was able to save the choice to the DB. So far […]

CMB2 – array_search or in_array from repeat_group and comma separated values

I have this data coming from $myoptions = my_get_option(‘my_repeat_group’); $p = ‘T1X 0L6’; // find me print_r($myoptions) = Array ( [0] => Array ( [region_name] => Alberta [postal_codes] => T1X 0L3,T1X 0L4,T1X 0L5,T1X 0L6,T1X 0L7 [region_discount] => .5 ) [1] => Array ( [region_name] => Ontario [postal_codes] => T1M 0W3,T1M 0W4,T1M 0W5,T1M 0W6,T1M 0W7 [region_discount] […]

Warn user that data may be lost for custom pages

When you edit a builtin field in WordPress like the title and don’t save the cahnges, and attempt to go to another link, a warning alert box comes up stating that “changes may be lost if you navigate …”. How can I make that same box appear for my own pages? Thanks!

Create tabs in admin options page from custom post type loop

For a WordPress crm/password management plugin I am working on, I have created a custom post type called ‘client’. I also have made a separate menu page for storing and showing the passwords of these clients (like an options page, just not used for managing options). What I would like to do is make a […]

Using Checkboxes on Plugin Options Page for Custom Plugin

I am creating my first WordPress plugin. It is a simple plugin that extends Visual Composer allowing you to remove the element options in VC (shown in the screenshot). On the plugin “options” page I am creating a form to show/hide the elements. Here is my code: // Going to add a conditional statement here […]

How to prevent options.php deleting valid existing data from the database

I am setting up a plugin and have used the setting API for the first time to create a form in settings. The data for the plugin is initially created by default when the plugin is activated and stored in the database in a serialized format. Today I added the validation callback function, which works […]

Settings API – input always updates over validation

I am following a WordPress book and am trying to create a plugin and have got an option page showing. In this page I have two text fields (which values are stored in one array). I am trying to add custom validation (for example if empty). The validation is set in the third argument in […]

Serialize data for wp options

I am creating my first ever plugin, its purpose is to show a notice when some conditions are met, I created the function in jQuery and initially I had to manually edit the file everytime I wanted to change the notice message, so I decided to create a settings page so that the user could […]

What is the correct form action URL for network options pages?

Referring to Settings API in Multisite – Missing update message It states that: For network option pages the correct form action URL is: wp-admin/network/edit.php?action=your_option_name Note: without a ‘/’ in front Okay. Let’s try it: <form method=”post” action=”wp-admin/network/edit.php?action=your_option_page”> Obviously, my options form actually gets submitted to: http://yourdomain.com/wp-admin/network/wp-admin/network/edit.php?action=your_option_page Now, adding a ‘/’ in front: <form method=”post” action=”/wp-admin/network/edit.php?action=your_option_page”> […]