• I have tried for hours to figure this out, and I can’t.

    If I use this
    update_post_meta($post_id, "_wp_page_template", "page-joblistings.php");
    it doesn’t update the template on the website itself. I checked the database, and it adds the correct values in the database. The correct post id is there, the correct template name is there, but it doesn’t update on the front end. If I go to the Page where I am trying to do this to, it shows the correct template in the template dropdown. If I hit the update button, it shows up on the front. WP Super Cache is enabled, but deleting that cache doesn’t fix it. I’ve tried to use wp_update_post with the page ID and maybe updating the time, but that doesn’t fix it.

    Any help would be appreciated!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Try

    1. Delete your browser cache.

    2. See if your host uses some kind of cache server like Varnish.

    Thread Starter Carl Wuensche

    (@stuffradio)

    1. I tried visiting the page on other devices, and it didn’t work. So it’s not the browser cache.

    2. The host is inmotionhosting.

    I don’t know anything about inmotionhosting, you’ll need to ask them about the caching. I had experience with some of my clients having issues with hosting cache before. Clearing them (web server level) solved the problem.

    Thread Starter Carl Wuensche

    (@stuffradio)

    I found out that it is using index.php, but it shouldn’t because in the database it is saying that it’s using the template I assigned it. So it doesn’t make sense.

    Thread Starter Carl Wuensche

    (@stuffradio)

    I fixed it. It was happening because I was setting the post_parent to something else that wasn’t a page. It made the page show up as a 404. I wish I used the developer tools a long time ago to see if it was showing a 404.

    I see, glad the issue is solved and thanks for sharing.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Update template’ is closed to new replies.