wordpress plugin: query post-ID in plugin?

后端 未结 3 1384
被撕碎了的回忆
被撕碎了的回忆 2021-01-28 02:03

hey guys, maybe some of you have experience with programming wordpress plugins. I have a probably rather simpel question, but i couldn\'t find anything on the web.



        
3条回答
  •  隐瞒了意图╮
    2021-01-28 02:29

    My guess is Use global keyword to access post id in function

    And also my guess is return and echo both would not work together in function

    function test($content) {
            global $post;
            return $post->ID.'
    '.$content; }

提交回复
热议问题