'_wp_page_template', 'meta_value' => 'page-addrecipe.php' )); $pages_recipelist = get_pages(array( 'meta_key' => '_wp_page_template', 'meta_value' => 'page-recipelist.php' )); ?> array(), 'em' => array(), 'b' => array(), 'i' => array(), //links 'a' => array( 'href' => array() ) ); $recipe_arr['post_title'] = wp_filter_nohtml_kses($_POST['post_title']); $recipe_arr['post_content'] = wp_kses($_POST['post_content'], $allowedtags); $recipe_arr['post_author'] = get_current_user_id(); $recipe_arr['post_status'] = 'pending'; $recipe_arr['post_type'] = 'recipes'; $recipe_arr['tax_input'] = array( 'recipes-categories' => intval($_POST['recipes_categories']), 'recipes-cuisine' => intval($_POST['recipes_cuisine']) ); if (!empty($_POST['recipe_id'])) { $recipe_arr['ID'] = intval($_POST['recipe_id']); } $post_recipe_ID = wp_insert_post($recipe_arr); // upload image if ($_FILES) { $size = intval($_FILES['recipe-image']['size']); if ($size > 0) { foreach ($_FILES as $file => $array) { $fixClass = new \AlexFW\AlexFW_Fix(); $newupload = $fixClass->alexfw_bigrecipe_insert_attachment($file, $post_recipe_ID, true); } } } if (!empty($_POST['difficulty'])) { $meta_value['difficulty'] = wp_kses($_POST['difficulty']); } if (!empty($_POST['time'])) { $meta_value['time'] = intval($_POST['time']); } if (!empty($_POST['serves'])) { $meta_value['serves'] = intval($_POST['serves']); } if (!empty($_POST['ingredients'])) { $meta_value['ingredients'] = wp_kses($_POST['ingredients']); } if (!empty($_POST['nutrition'])) { $meta_value['nutrition'] = wp_kses($_POST['nutrition']); } if (!empty($_POST['preparation'])) { $meta_value['preparation'] = wp_kses($_POST['preparation']); } if (!add_post_meta($post_recipe_ID, '_recipe_page_options', array_filter($meta_value), true)) { update_post_meta($post_recipe_ID, '_recipe_page_options', array_filter($meta_value)); } } if (!empty($_GET['del_recipe'])) { $post_recipe = get_post($_GET['del_recipe']); // Premision for recipe if ($post_recipe->post_author != get_current_user_id()) { get_header(); get_template_part('permission_denied'); get_footer(); exit; } else { wp_delete_post($_GET['del_recipe']); } } ?>