• Hi,
    I’m letting users upload their post to a custom post type. This custom post type also have a custom taxonomy called book_category. I’m trying to let users assign their category via the following FU shortcode:

    [fu-upload-form title="Upload your media" form_layout="post_media" post_type="book"]
    [input type="text" name="post_title" id="title" class="required" description="Titolo"]
    
    [select name="?book_category" description="category" class="select" description="Please select" values="31:Novel,32:Thriller,33:Noir"]
    [input type="submit" class="btn" value="Publish"]
    [/fu-upload-form]

    This generates an error, the result page is a blank page with a 0 (zero) printed on.

    Is this a bug?

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter Sergio De Falco

    (@sgr33n)

    I solved via fu_after_create_post filter. If somebody else need it, here it is:

    function sgr_fu_after_create_post( $post_id ) {
    	// Get the post object
    	$post = get_post( $post_id );
    
    	// Exit if it's not a book
    	if ( 'book' != $post->post_type )
    		return;
    
    	// Add the term from $_POST value
    	wp_set_post_terms( $post_id, $_POST["?book_category"], 'novel_category' );
    	// Remove the $_POST value
    	unset( $_POST["?book_category"] );
    }
    add_filter( 'fu_after_create_post', 'sgr_fu_after_create_post' );
    the masked cat

    (@iniblogbudi)

    Hi Sergio @sgr33n,

    I think I have the problem as yours. I want to implementing your code in my functions.php but I need your help (or from anybody in this society).

    From your example code, I know that your custom post’s slug is “book”, and your custom taxonomy’s slug is “book_category”. But I have no idea what is the “novel_category” as in your code.

    I am a php beginner. Could you help me, please.

    Thread Starter Sergio De Falco

    (@sgr33n)

    Hi,
    It was the original post type that I masked as book ??
    Change it to book in the example.

    the masked cat

    (@iniblogbudi)

    Thanks ??

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Problem with custom taxonomy’ is closed to new replies.