Skip to main content
18 events
when toggle format what by license comment
Dec 10, 2019 at 22:21 vote accept TKEz
Nov 24, 2019 at 9:00 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Jul 19, 2019 at 4:05 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Mar 18, 2019 at 7:01 history bumped CommunityBot This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
Sep 12, 2017 at 15:53 answer added TKEz timeline score: 0
Sep 12, 2017 at 14:23 comment added TKEz To be clear, the error is being thrown by a wordpress core file. It's because in the core the line $post_type = get_post_type_object($post->post_type); is returning null but later in the function it attempts to access a property of the $post_type object. Not sure how to work around this without modding the core.
Sep 12, 2017 at 13:17 comment added TKEz Here is a condensed version of $this: object(Research_Center)[1236] public 'ID' => int 145 public 'post' => object(WP_Post)[1238] public 'ID' => int 145 public 'post_name' => string 'cvt' (length=4) public 'post_type' => string 'research_centers' (length=16) public 'filter' => string 'raw' (length=3)) protected 'permalink' => string 'localhost.dev' (length=30)
Sep 12, 2017 at 13:15 comment added TKEz var_dump($this) is too long to post in a comment. I did however update the code in the question to give more context.
Sep 12, 2017 at 13:09 history edited TKEz CC BY-SA 3.0
added 1940 characters in body
Sep 12, 2017 at 5:00 comment added Annapurna Can you var_dump($this) and paste the value returned.
Sep 12, 2017 at 2:54 review Close votes
Sep 26, 2017 at 3:01
Sep 12, 2017 at 2:38 comment added Mark Kaplun downvoted and close voted as it is impossible to guess what part of your code is broken without access to all of it, but you start with making sure you are passing an actual existing post id.
Sep 11, 2017 at 21:48 comment added WebElaine Perhaps you haven't called global $post to be able to access it?
Sep 11, 2017 at 20:47 comment added Jeff Mattson Can you post more of the code?
Sep 11, 2017 at 20:40 comment added Jeff Mattson If you simply return $permalink instead of return $this->permalink; do you still get the error? Comment out the $this->permalink = $permalink; just incase.
Sep 11, 2017 at 20:37 comment added TKEz Sorry, I only posted a small portion of the code. I should have put more. So the block of code with $this->permalink is actually within a class. The file that's throwing the error is link-template.php which is erroring because $post_type (on line 264) is not an object.
Sep 11, 2017 at 20:34 comment added Mihai Papuc Looks like $this is not an object, maybe you want to use $post?
Sep 11, 2017 at 20:32 history asked TKEz CC BY-SA 3.0