Title: Customize post data
Last modified: February 14, 2018

---

# Customize post data

 *  Resolved [delgelato](https://wordpress.org/support/users/delgelato/)
 * (@delgelato)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/)
 * Halo. I’m trying to add/customize the post data somehow:
    1. Add a dropdown in
   the form (submission-form.php) 2. Retrieve the $_POST and add metadata with the
   value (user-submitted-posts.php) 3. Display it.
 * I can manage the coding but I’m super new to working with wordpress plugin(avoid
   losing changes when update) and work with existing hooks.
    I have my own plugin.
   php and just copied the whole [usp_display_post] and made my own there. This 
   is simple bcoz it’s just displaying. Are there hooks that I can use to:
 * 1. Add that dropdown option into the form (and say, I wanna put this after the
   Email form or somewhere)
 * 2. I just wanna “update_post_meta($post_id, ‘my_meta_name’, value in custom field);”
   How to do that?
    There’s: usp_createPublicSubmission($title, $files, $ip, $author,
   $url, $email, $tags, $captcha, $verify, $content, $category, $custom); So if 
   I just wanna add 1 more param, without changing the plugin directly, is that 
   possible? And still related to this. Can I still retrieve post: $bla = $_POST[‘
   chosen_dropdown’]; then if I hook in: do_action(‘usp_insert_after’, $newPost);
   Use the post_id and add_post_meta($post_id, ‘my_meta_name’, $bla); Or even: add_post_meta(
   $post_id, ‘my_meta_name’, $_POST[‘chosen_dropdown’]);
 * Sorry if this is not the best place to ask this (workflow for customizing plugins
   with hooks). I’ve been reading about all this and still don’t know where to start.
   Posted here bcoz USP is the main thing I need to customize and this shouldn’t
   be(??) to hard to accomplish? But is this generally the right way for these kinda
   plugin edits?
 * Thanks so much. I’m very new to WP and hoping to be able to comfortably work 
   with plugins.
    Cheers!

Viewing 12 replies - 1 through 12 (of 12 total)

 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9974968)
 * Glad to help!
 * 1) “So if I just wanna add 1 more param, without changing the plugin directly,
   is that possible?”
 * Not in the free version of USP, but the Pro version can handle unlimited fields
   and forms.
 * 2) “Can I still retrieve post: …”
 * It’s not a built-in/provided feature of the plugin, but it may be possible using
   custom code.
 * 3) “Posted here bcoz USP is the main thing I need to customize and this shouldn’t
   be(??) to hard to accomplish? But is this generally the right way for these kinda
   plugin edits?”
 * The recommended way to modify default plugin behavior is hooks. Check out WP 
   action and filter hooks should open a lot of doors for you.
 * Let me know if I can provide any further infos, glad to help.
 *  Thread Starter [delgelato](https://wordpress.org/support/users/delgelato/)
 * (@delgelato)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975262)
 * Hi thanks for the reply!
    Yes I’ve read about hooks. It’s just applying it(to
   modify) to a plugin is what I haven’t tried.
 * Keep in mind I’m a super beginner.
 * From Ian Dunn’s guide to work with plugin, among all the methods he suggested,
   I might go with Adding Custom Hooks(which is just adding a do_action/filter as
   necessary in the plugin, and add callback in my own php).
    He also mentioned 
   in that part that I can ask you to add those hooks in the next update. Just wondering
   if that’s possible? I’m not sure yet where these hooks should be added for this
   case though, and maybe you wouldn’t think it’s important enough (unless they’re
   present in the Pro).
 * Anyways, thanks for replying. I was ready to do stuff but wanted to confirm with
   you about these stuff.
    And if I may ask another thing about 2) “Can I still 
   retrieve post: …”
 * I just don’t know what to search about this, basically where can I access $_post.
   
   In your form, action=””. So all processing you do goes to current page. All in“
   user-submitted-posts.php”. Where else can $_post mean the user posted data? If
   I `add_action('parse_request', 'my_func', 2);` Can my_func access $_post too?
   Or if you can point me to the right direction for this.. I’m not totally lost.
   Have been just reading for a few days and some of the dots are still all over
   the place, and because of this I’m hesitating to even start.. Thanks!
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975309)
 * Glad to help:
 * 1) “He also mentioned in that part that I can ask you to add those hooks in the
   next update. Just wondering if that’s possible?”
 * Definitely possible, depends on the specifics.
 * 2) “Where else can $_post mean the user posted data?”
 * It looks like your posted code was mangled somehow. If you can re-post, this 
   time wrapping all code with code tags or backticks, I will be glad to take a 
   look.
 * Keep in mind that time for free support is limited, so please try to keep your
   questions focused and to the point, and using numbered lists always helps.
 * Thanks!
 *  Thread Starter [delgelato](https://wordpress.org/support/users/delgelato/)
 * (@delgelato)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975328)
 * The code was just
    add_action(‘parse_request’, ‘my_func’, 2);
 * Basicly right after your
    add_action(‘parse_request’, ‘usp_checkForPublicSubmission’,
   1);
 * Thanks!
    And yes this is probably not really support but a little bit of private
   tutor… It’s not urgent but thanks for following through!
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975388)
 * This:
 * `add_action('parse_request', 'my_func', 2);`
 * ..is something that can be added via theme functions or simple custom plugin.
   There is no need to add to USP core.
 *  Thread Starter [delgelato](https://wordpress.org/support/users/delgelato/)
 * (@delgelato)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975443)
 * Yep sorry I mean I’ll put that in custom plugin.
    But then can myfunc() contain
   $_post?
 * I’ll just try it actually.
    I’ll get back when I decide where the additional 
   hook’s gonna be. Cheers!
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975445)
 * Yes the best way to find out is just play around with it on a test/dev WP site.
   That way you can experiment freely without breaking anything. Have fun!
 *  Thread Starter [delgelato](https://wordpress.org/support/users/delgelato/)
 * (@delgelato)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975534)
 * Halo, back again. The $_POST works in the callback so that’s good. So…
 * (This is for modifying the form part)
    I was planning to apply_filter right around
   the end of the form html, then in the callback I can insert the changes. Find
   string index of say, `<fieldset class="usp-category">` Find the index of the 
   occurring string and insert my custom field right before that.
 * But in your submission-form.php where you have the html for the form, the whole
   html content string is not in a variable.
    I wonder if filter can work somehow
   in this case?
 * Or should I just build my own form? How would I use submission-form-alt.php? 
   Should I just modify that -alt and use that(how?)
    Make custom shortcode that
   calls something like usp_display_form() but instead change to /views/submission-
   form-alt.php ? I read in the FAQ to do this but was also told the -alt can’t 
   do cookie clearing, and then I can’t find more info about it. Cheers!
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975560)
 * Yeah it sounds like you’ll need to use a custom form. Check out the Installation
   tab on the plugin homepage. There you can find steps for setting up a custom 
   form. The only downside as you mention is the lack of automatic cookie clearing.
 *  Thread Starter [delgelato](https://wordpress.org/support/users/delgelato/)
 * (@delgelato)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975755)
 * I did it with this filter you already provided:
    return apply_filters(‘usp_form_shortcode’,
   ob_get_clean()); So I don’t need to use the -alt. Awesomeness. Just the server
   side processing, add a meta value to store this new field. Who knows, maybe I
   don’t need to ask you to add any custom hook to achieve what I need. I’ll let
   you know tomorrow, now bed time. Thanks for the much needed support. I’m glad
   the first plugin I mess around with is this one! As for the adding some hooks,
   should I let you know again in this topic or some other way?
 *  Plugin Author [Jeff Starr](https://wordpress.org/support/users/specialk/)
 * (@specialk)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9975768)
 * Sounds like you’re having fun and figuring things out, so kudos to you. And yeah,
   if you need any hooks added, just let me know where, and if any variables also
   should be passed along. Posting again on this thread is fine, as it follows from
   the topic.
 *  Thread Starter [delgelato](https://wordpress.org/support/users/delgelato/)
 * (@delgelato)
 * [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9987689)
 * Halo again. I’ve done all the things on the USP side with existing hooks, so 
   gonna cancel the request to add some new ones. This topic’s done, thanks!
 * Although the displaying part is another topic
    (continued here: [https://wordpress.org/support/topic/customize-theme-display-post-embed/#new-post](https://wordpress.org/support/topic/customize-theme-display-post-embed/#new-post))
 * I’m just using the usp_display_posts shortcode to display, but this one just 
   displays them all, without pagination like how posts are displayed through the
   theme (CMIIW), and if it can work with say, the theme’s grid layout for posts.
   Trying to work with existing theme to customize what data they display in their
   loop, to display USP posts thru the theme instead.
    Or I don’t know what I’m 
   talking about. Working with themes are another thing, same issue; been just reading
   and don’t know where to start…
 * Anyways, thanks again!
    Cheers

Viewing 12 replies - 1 through 12 (of 12 total)

The topic ‘Customize post data’ is closed to new replies.

 * ![](https://ps.w.org/user-submitted-posts/assets/icon-256x256.png?rev=2567685)
 * [User Submitted Posts – Enable Users to Submit Posts from the Front End](https://wordpress.org/plugins/user-submitted-posts/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/user-submitted-posts/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/user-submitted-posts/)
 * [Active Topics](https://wordpress.org/support/plugin/user-submitted-posts/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-submitted-posts/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-submitted-posts/reviews/)

## Tags

 * [form](https://wordpress.org/support/topic-tag/form/)

 * 12 replies
 * 2 participants
 * Last reply from: [delgelato](https://wordpress.org/support/users/delgelato/)
 * Last activity: [8 years, 3 months ago](https://wordpress.org/support/topic/customize-post-data/#post-9987689)
 * Status: resolved