Hi,
if i understand correctly only the wpa_brand meta is being added to all of the post types?
Also, can you paste here the code you are using to add the custom field and save it?
Hello Greg,
Thanks for your feedback. Here is the code to add and save the meta field in the WPAdverts form.
add_filter( “adverts_form_load”, “customize_adverts_add” );
function customize_adverts_add( $form ) {
if( $form[‘name’] != “advert” ) {
return $form;
}
// List of brands
$args = array( ‘hide_empty’ => false, ‘fields’ => ‘tt_ids’,’orderby’ => ‘name’ );
$brands = yith_wcbr_get_terms(‘yith_product_brand’, $args);
$brand_name_temp = array();
$array_init[0] = array(“value” => “0”, “text” => __(“Other”,”adverts”));
foreach ($brands as $key => $brand_id) {
$brand = get_term($brand_id);
$brand_name_temp[] = array(“value” => $brand_id, “text” => $brand->name);
}
$brand_name = array_merge ($array_init, $brand_name_temp);
//Edit WPAdvert form
$form[“field”][] = array(
“name” => “wpa_brand”,
“type” => “adverts_field_select”,
“order” => 11,
“label” => __(“Brand”, “adverts”),
“is_required” => false,
“validator” => array( array( “name” => “is_required” )),
“empty_option” => false,
“max_choices” => 1,
“options” => $brand_name,
);
return $form;
}
Thanks, it seems like there is some kind of bug, please try opening a file wpadverts/includes/adverts-post-type.php go to line about 49, replace the line
if ( !$post->post_type == 'advert' ) {
with
if ( $post->post_type != 'advert' ) {
and see if it helps?
Hello Greg,
Correction seems to work. I have made several tests and there is no extra meta added to post other than advert.
Thanks !
Ok great, thanks for the feedback i will be adding the same update in the next WPAdverts release.
I am closing this thread for now then.