朱纯树博客
VPS测评推荐网站
cloudacead cloudacead

WordPress纯代码实现给自定类型分类法投稿

目前本站使用的主题自带网址导航,但是没有投稿网址的功能,所以本站就琢磨怎么也得增加一个用户投稿网站的功能。

其实就是一个网站投稿的功能,但是并不是投稿到文章内,而是投稿给自定义分类发,也就是网址栏目,这就有点绕了。

经过一阵子搜索,终于找到实现投稿自定类型分类法方法了。

功能代码


$add_post = array(
        'post_type' => 'buluo',//类型
        'post_title' => $_POST['bbs_post_title'],// 标题
        'post_content' => $new_content, //内容
        'post_status' => 'pending',//提交是公开还是审核的
        'tax_input'=>array(
		'buluo_category'=>array($themes_id),//获取自定分类法id,buluo_category注意是您注册的分类法
         )
    );
$status = wp_insert_post( $add_post);//插入数据库

结合上面的代码,然后配合前台投稿表达,即可实现 投稿自定类型分类法方法了。

赞(2) 打赏
未经允许不得转载:VPS测评推荐网站 - 朱纯树博客 » WordPress纯代码实现给自定类型分类法投稿

评论 21

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
  1. #30

    It’s very straightforward to find out any matter on net as
    compared to books, as I found this post at this
    web site.

  2. #29

    Heya! I’m at work surfing around your blog from my new iphone 3gs!

    Just wanted to say I love reading your blog and look forward to all your
    posts! Carry on the superb work!

  3. #28

    I couldn’t refrain from commenting. Exceptionally well
    written!

  4. #27

    obviously like your web-site however you need to test the spelling on several of your posts.
    A number of them are rife with spelling issues and I
    in finding it very troublesome to tell the truth however I will certainly come again again.

  5. #26

    I’m gone to convey my little brother, that he should also pay a quick visit this blog on regular basis to obtain updated from
    latest gossip.

    tinyurl.com2周前 (07-28)回复
  6. #25

    I was recommended this website by my cousin. I’m not sure whether this post is written by him as no one else know
    such detailed about my trouble. You’re incredible!
    Thanks!

    tinyurl.com2周前 (07-28)回复