• buchannon

    (@buchannon)


    I’m having some trouble using the wp_insert_post function. Everything was working fine, then for some reason when I post something new, I get a HTTP 500 error in IE (no error in Firefox, the page just doesn’t load). I don’t remember triggering anything to have made this stop working. I even reverted back to an older version I know was working and get the same error.

    I took a look at my apache logs and here seems to be the culprit.
    [error] [client 127.0.0.1] PHP Fatal error: Call to a member function get_page_permastruct() on a non-object in C:\\Apache\\htdocs\\wp-tb\\wp-includes\\link-template.php on line 139, referer: https://tb.dev/?page_id=3

    The curious part is that it posts the info to the database, but gives the page error in IE after that. If I comment out the line: wp_insert_post($tb_form_post);
    Everything seems to work fine – except that it isn’t posting to the database.

    I was thinking redirect, or link issue? Any ideas?
    Thanks.

Viewing 2 replies - 1 through 2 (of 2 total)
  • russellduckworth

    (@russellduckworth)

    I’m experiencing the same issue, and the same scenario: no changes to the site. When I post a test comment I get the HTTP 500, but I can page back and the test comment is right there (for me to delete again). Just started out-of-the-blue as best I can tell.

    Thread Starter buchannon

    (@buchannon)

    russellduckwort, mine was resolved. I’m pretty sure the original form code must be in an wordpress action or filter. Mine was outside of everything and when the form function was put back into a filter, it started working again.

    add_filter(‘the_content’, ‘tb_form_filter’);

    I also made a completely separate php file to handle the form info and then redirect back to another page. So far so good.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘PHP Fatal error: Call to a member function get_page_permastruct()’ is closed to new replies.