• I am working on a plugin that needs to write a page to WP, and I’ve got everything working except that the page needs to use a particular page template. I can’t find that in wp_posts, and I’ve done a search of the entire DB for the name of that particular page template and can’t find it there either.

    Any idea how I should go about this?

Viewing 2 replies - 1 through 2 (of 2 total)
  • I was doing some MU data migration for an old MU site site (pre 3.0), and did something like this:

    $new_post_id = wp_insert_post($postdata);
    update_post_meta($new_post_id, '_wp_page_template', 'my-page-template.php')

    It may need tweaking for 3.0+ goodness, but hopefully it’s a helpful pointer in the right direction!

    Thread Starter jlknauff

    (@jlknauff)

    Ahh…I figured it was in wp_postmeta but couldn’t find it…turns out it’s using the page template FILE name rather than the name declared in the page template.

    Thanks, you saved me from a few more gray hairs ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Where is page template info in database?’ is closed to new replies.