0

I'm getting a little confused between the options and settings APIs. I want to add three multirow text fields (displayed as a textarea) for my plugin. I just want to allow the user to specify three pieces of data which are accessible to my plugin (I assume under the settings menu but if there is another option I'm open to that).

I would really prefer not have to manage HTML (by creating a form as I've seen in other examples) inside of my plugin. Is there a way to just specify that I want an entry field and then add a CSS class to it that makes the field display as a textarea rather than just a single line? Or, instead of embedding HTML inside my plugin, could I use a template (that I ship with my plugin as a separate file) and interpolate values into it (not sure if that is actually simpler, but I struggle with HTML properly escaped between the PHP <? open and close ?> tags).

So, I think I have two questions:

  1. How do I create/register these options for my plugin? (Is options the correct term in this context?)
  2. How do I use the options inside my plugin. My plugin uses the add_filter function to filter content, and I would like to use the values set for my options inside the function I register.
  • Or, could I ask people to edit files included with the plug-in? It doesn't seem like you can edit those from the editor (only the actual plug-in, right)? – xrd Jan 14 '18 at 18:33
  • to create a page for a user input, you can use this : developer.wordpress.org/reference/functions/add_menu_page – mmm Jan 16 '18 at 14:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.