When User Meta amended update Title and Slug of Post programatically
When User Meta amended update Title and Slug of Post programatically
When User Meta amended update Title and Slug of Post programatically
You could add the additional check to your foreach loop to see if the post with exactly same slug as the one you’re about to add already exists. Kinda difficult to tell exactly what you would have to do without seeing your current code. I’m assuming you know the slug and a type of a … Read more
Hello Tejas you may please alter your code below and let me know if it worked for you . foreach ($files[‘name’] as $key => $value) { $file = array( ‘name’ => $files[‘name’][$key], ‘type’ => $files[‘type’][$key], ‘tmp_name’ => $files[‘tmp_name’][$key], ‘error’ => $files[‘error’][$key], ‘size’ => $files[‘size’][$key] ); $_FILES = array (“files” => $file); foreach ($_FILES as $file … Read more
I have found a solution without adding any other metaboxes. I haven’t thought about it but the import function in my plugin uses a nonce so I just check if my nonce is set or not. Here is my save_post_events function: add_action( ‘save_post_events’, ‘wse_327066_example’, 10, 3); function wse_327066_example( $post_id, $post, $update ) { if ( … Read more
// set Selected Post CATEGORY cheked wp_set_object_terms( $post_id, array((int)$_POST[‘movies_cat’]), ‘movies’ ); } else{ die(“check seccurity”);} // This bellow given code add on design page <p class=”meta-options hcf_field”> <label for=”movies”>The Categories</label> <?php wp_dropdown_categories( ‘taxonomy=movies&name=movies_cat&show_option_all=Select a category’ ); ?> </p>
Auto-Select Parent Category as Primary
Ah, I solved it! The problem was that outside of the admin panel WP does not load wp-admin. The solution was to add if (!is_admin()) { require_once(ABSPATH . ‘wp-admin/includes/post.php’); } Now it works like a charm! 🙂
Thank @Sally CJ I made the solution : main code global $sitepress_settings; //Insert post with main lang $post = $binding_main_cpt[‘post’]; $default_language = $sitepress_settings[‘default_language’]; $main_post = $post[$default_language]; $postInformation = [ ‘post_title’ => wp_strip_all_tags(trim($main_post[‘post_title’] ) ), ‘post_content’ => $main_post[‘post_content’], ‘post_type’ => $main_post_type, ‘post_status’ => ‘publish’ ]; $master_post_id = wp_insert_post($postInformation); echo sprintf( “insert post %d”, $master_post_id ); foreach($sitepress_settings[‘active_languages’] … Read more
how to upload a image from frontend with wp_insert_post and also update_post_meta?
$args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, ‘post_parent’ => $post->ID, ); $children= new WP_Query( $args ); $seasonepisode = array( ‘post_title’ => $episodetitle, ‘post_content’ => ‘Some Content’, ‘post_status’ => ‘publish’, ‘post_parent’ => $post->ID, ‘post_type’ => ‘page’, ‘page_template’ => ‘template-songlist.php’ ); if ( $children->have_posts() ){ while ( $children->have_posts() ) { $children->the_post(); if(get_the_title() != $episodetitle){ wp_insert_post($seasonepisode); … Read more