0

高度なカスタム フィールド フロント エンドの投稿を使用しています。

<?php 

function my_pre_save_post( $post_id )
{
    // check if this is to be a new post
    if( $post_id != 'new' )
    {
        return $post_id;
    }

    // Create a new post
    $post = array(
        'post_status'  => 'draft' ,
        'post_title'  => 'A title, maybe a $_POST variable' ,
        'post_type'  => 'post' ,
    );  

    // insert the post
    $post_id = wp_insert_post( $post ); 

    // update $_POST['return']
    $_POST['return'] = add_query_arg( array('post_id' => $post_id), $_POST['return'] );    

    // return the new ID
    return $post_id;
}

add_filter('acf/pre_save_post' , 'my_pre_save_post' );

?>

この方法を使いたい

<?php
$original_blog_id = get_current_blog_id(); // get current blog

$bids = array(1,2); // all the blog_id's to loop through
foreach($bids as $bid):
       switch_to_blog($bid); //switched to blog with blog_id $bid
       // ... your code for each blog ...
endforeach ; 

switch_to_blog( $original_blog_id ); //switched back to current blog
?>

複数のブログに同時に投稿する方法を教えてください。私を助けてください。

4

1 に答える 1

0

問題が解決しました!。私はここから解決策を得ました。 http://support.advancedcustomfields.com/forums/topic/front-end-posting-to-multiple-blog/

于 2013-11-14T09:07:22.533 に答える