sunder
Forum Replies Created
-
Forum: Plugins
In reply to: [Contact Form 7] [Plugin: Contact Form 7] server migration, CF7 404 errorThis problem was caused by the following:
We are using PearDB to connect to our local (CMS) database (DB). When we establish the link with PearDB, it selects our CMS schema. Which effectively UNselects the wordpress schema. Thus, WordPress isn’t finding the posts.
This did not occur on the old server because the CMS DB and the WordPress DBs were all under different MySQL accounts. The PHP documentation for mysql_connect() explains this:
“If a second call is made to mysql_connect() with the same arguments, no new link will be established, but instead, the link identifier of the already opened link will be returned.”
Now, to fix it we have a couple of options, some better than others.
For a temporary fix (being implemented right now), we can hack the wordpress instance as per: https://www.ads-software.com/support/topic/cant-use-pear-db-classes-when-inside-wp-themes?replies=1
The idea is to add mysql_select_db() in to wp-includes/wp-db.php’s query() function.
The disadvantage to this is that the database name must be hard coded into that file. As well, it adds a performance penalty since there will be an extra database query for every one WordPress makes. Most significant, however, is that this hack will be undone every time wordpress is changed or upgraded.Forum: Plugins
In reply to: [Contact Form 7] [Plugin: Contact Form 7] server migration, CF7 404 errorJust to clarify…
The post I expect to be returned by get_post() exists in wp_posts table.
Also, it does show up in the administration panel for Contact Form 7 (even provides me the short code to include it on a page).