Home Forums Plugin Support WP User Frontend Pro Use a url parameter as an input inside my form

This topic is: resolved

This topic contains 2 replies, has 2 voices, and was last updated by  Sekander Badsha 4 years, 8 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
  • #26289

    Post count: 2

    My product categories are more than 100 hundred(categories,subcategories and sub subcategories). Thus when the user wants to add a new product is very difficult for him to choose the right product category. What is possible is to break the forms one for each main product category.
    Is there a way though that I can limit down the forms into only one by having preselected from before the product category I want to add the product ?
    I can use the following code to update a product category with a hidden field
    function wpuf_update_hidden_product_types($post_id) {

    function wpuf_update_hidden_categories($post_id) {

    $cats = $_POST[‘product_category'];
    // $cats = htmlspecialchars($_GET[“product_category”]);
    $categories = array_map(‘intval', explode (‘,', $cats));
    wp_set_object_terms( $post_id, $categories, ‘product_cat');
    // Optional to clean up the database (deletes the hidden field data after converting it into object terms)
    delete_post_meta( $post_id, ‘product_categories', $_POST[‘product_categories'] );
    add_action( ‘wpuf_add_post_after_insert', ‘wpuf_update_hidden_categories' );
    add_action( ‘wpuf_edit_post_after_update', ‘wpuf_update_hidden_categories' );

    What I want is to pass the product category on the url

    I have tried the $_GET command but with no success.
    I have tried and succeeded to add a fixed metavalue inside a hidden field with the name product_category but I do not want a fixed value but a variable value taken from url.
    Is there a way I can add a variable value inside a hidden field meta value and how?


    Post count: 2

    Still Waiting for a reply!!


    Sekander Badsha
    Post count: 2067

    Hello kyriakosdz,
    If you have lots of categories and sub categories, you can use the Ajax categories. It will show you the parent categories first and will show the child after selecting the parent. But remember, this Ajax only works if the user is logged in.

Viewing 3 posts - 1 through 3 (of 3 total)

The topic ‘Use a url parameter as an input inside my form’ is closed to new replies.