每次在WordPress中发布新帖子时,如何从帖子作者的Twitter帐户自动发推文(How to tweet automatically from the post author's Tw

编程入门 行业动态 更新时间:2024-10-28 02:30:05
每次在WordPress中发布新帖子时,如何从帖子作者的Twitter帐户自动发推文(How to tweet automatically from the post author's Twitter account each time a new post is published in WordPress)

我的目标是在我的WordPress网站上发布新帖子时自动发送推文。

我知道如何发送实际的推文。 我将使用Twitter Intents这样做我将把我的Intent挂钩到publish_post动作钩子。 $post_id传递给我的动作函数,所以我可以使用get_post( $post_id )函数获取帖子标题,作者ID等。

问题

我有多位作者,所以需要找到一种方式从帖子作者的Twitter帐户发送推文。

有一个名为Social的WordPress插件可以做到这一点,但插件有很多我不需要的额外功能。 此外,当我激活它时,我收到了很多PHP调试通知,所以我更愿意自己编写解决方案。

My aim is to send a tweet automatically when a new post has been published on my WordPress site.

I know how to send the actual tweet. I'm going to do that using Twitter Intents I'll hook my Intent to the publish_post action hook. $post_id is passed to my action function so I can get the post title, author ID etc using the get_post( $post_id ) function.

The problem

I have multiple authors so need to find a way sending the tweet from the post author's Twitter account.

There is a WordPress plugin called Social which does this but the plugin has lots of extra functionality which I don't need. Also, I get lots of PHP debug notices when I have it activated so would prefer to code a solution myself.

最满意答案

将twitter用户名附加到每个作者(非常类似于发布元字段,请参阅本教程 。

作为发布后加载回调的一部分,作者元与twitter意图一起使用。

Attach a twitter username to each of your authors (very similar to post meta fields, see this tutorial.

As part of your callback on publish post load the author meta to use with twitter intents.

更多推荐

本文发布于:2023-07-19 21:47:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1187542.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:子时   新帖   帐户   帖子   作者

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!