我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

如何在单击wordpress上更新发布日期时间

so i need to make button or link which will update post publish date.

i found this but i dont know how to call it.

$time = current_time('mysql');

wp_update_post(
    array (
        'ID'            => $id,
        'post_date'     => $time,
        'post_date_gmt' => get_gmt_from_date( $time )
    )
);

Please check this:

$mypost = array();
$mypost['ID'] = 1; // the post ID you want to update
$mypost['post_date'] = $your_date; // uses 'Y-m-d H:i:s' format
wp_update_post($mypost);

Hope this helps..

近期文章

  • 创建一个循环来显示具有相同成分的食谱
  • 在Laravel中实现与Cache :: disk('x')类似的功能
  • 在发送批量电子邮件时,我发现使用codeigniter时出错
  • HAproxy配置为Laravel
  • yii2:xampp升级到php7
  • 使用php中的值到jquery
  • PHP - 为什么日期之间的差异显示错误的日期?
  • 带有PostgreSQL 9.5的Laravel 5.4
  • 验证数据,登录系统codeigniter
  • JSON字符串中的格式错误
  • 缓存已呈现的数据库查询页面
  • Javascript没有加载mysql数据phonegap
  • Mysqli到PDO绑定参数
  • 使用点分隔符将日期转换为另一种没有点的格式[重复]
  • 高级自定义字段wordpress自定义类
  • 如何仅使用字段组中的选定字段显示ACF前端表单?
  • 在购物车codeigniter中添加并显示列表产品
  • 每次乘法的SQL行
  • 尝试更新阵列时出现“间接修改重载属性无效”的错误
  • 从foreach循环内的数据库填充数组并稍后获取它

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华