WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Database postmeta table prefix defaults to wp- when using theme custom page (7 posts)

  1. TangerineFrog
    Member
    Posted 1 year ago #

    Not sure whether anyone else has had this same problem.

    I had previously changed the database table default prefixes from wp- to a custom number as recommended by WP to prevent hackers. However, since the last WP update I have found that each time I apply a custom page template in my theme to a page on my website it changes my custom number in the DB of that particular page back to its default of wp-.

    If I then edit the wp- and change it back to my custom number, it changes the custom page template in my theme back to it's default (ie. Default Template) and I lose all the customisations of the custom page template.

    I've tried changing the database table prefixes I was using to a different number and also re-created a new wp-config.php file and changed themes to rule out the problem being theme-specific—all to no avail.

    Perhaps something is over-riding the wp-config.php file? Does anyone have any ideas what the problem could be and how it could be solved?

    Thanks.

  2. Pankaj Pandey
    Member
    Posted 1 year ago #

    Its really strange, How you are sure that db prefix is changed, can you list down all the table of your DB.

  3. TangerineFrog
    Member
    Posted 1 year ago #

    Thanks for your reply. It's odd. I have the DB and my web page side by side in different browsers and can physically see the change when I refresh the screen. I've never had this happen before.

    A single entry in the _postmeta table in the meta_key column changes from _xxxxxxxx_page_template back to the wp default of _wp_page_template.

  4. Pankaj Pandey
    Member
    Posted 1 year ago #

    _wp_page_template is default custom field which keep the template information. Nothing wrong with your setup.

  5. TangerineFrog
    Member
    Posted 1 year ago #

    In codex.wordpress.org they advise changing the prefix to prevent SQL-injection attacks. I've used different prefixes in a DB before without a problem until now. Below is an excerpt from the codex:

    codex.wordpress.org/Hardening_WordPress

    Change the table_prefix: Many published WordPress-specific SQL-injection attacks make the assumption that the table_prefix is wp_, the default. Changing this can block at least some SQL injection attacks.

    Thanks.

  6. Pankaj Pandey
    Member
    Posted 1 year ago #

    you need to check your WP db prefix you dont have to check DB value

    _wp_page_template is a meta property of your page which is saved in your db. have a look at all table which used in WP are http://codex.wordpress.org/images/9/9e/WP3.0-ERD.png

    In image you can see all name started with wp_ . ih your suggested article you need to change wp_ to xyz_ where xyz is your chosen prefix.

    You dont have to change the meta value as _wp_page_template is default keyword.

    http://jorgepedret.com/web-development/get-pages-by-template-name-in-wordpress/

  7. TangerineFrog
    Member
    Posted 1 year ago #

    Thank you for explaining that to me, Pankaj. The information in the links make complete sense—much appreciated.

    I'll now mark the topic as resolved.

Topic Closed

This topic has been closed to new replies.

About this Topic