We got an permalink issue after adding a wordpress website live (from dev to live website I mean)
I got this error line on all pages except the welcome page :
Warning: preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 1 in /var/www/vhosts/xxxxxxxx.com/httpdocs/wp-includes/class-wp.php on line 223
Warning: preg_match(): Compilation failed: quantifier does not follow a repeatable item at offset 1 in /var/www/vhosts/xxxxxxxx.com/httpdocs/wp-includes/class-wp.php on line 224
I f I go to setting/permalinks and I change for plain, error lines are not showing anymore. But if I go back to post name or custom structure and save these options, problem come back...
Could you help me with this issue? Everything was working good on dev...I don t understand what happened after the live migration...
Thx for your help.
Try to change url in .htaccess file, check if there is folder written.
Change old url to new url in database, here is the way you can do with query:
UPDATE wp_options SET option_value = replace(option_value, 'http://www.oldurl', 'http://www.newurl') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.oldurl','http://www.newurl');
UPDATE wp_posts SET post_content = replace(post_content, 'http://www.oldurl', 'http://www.newurl');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://www.oldurl','http://www.newurl');
Related
I have the following site http://imosigbroker.ro/. Logo and some pictures have been broken after I migrated the localhost site on the host. I tried to add these photos manually in WP via Media > Select Files and I got the following message error: "Missing a temporary file."
I set all DB files from localhost to my site with a plugin. This is not the issue of the website right now.
The debug shown the following:
Notice: Constant WP_DEBUG already defined in /home/imosigbr/public_html/wp-config.php on line 96
Notice: Constant SCRIPT_DEBUG already defined in /home/imosigbr/public_html/wp-config.php on line 97
Warning: Cannot modify header information - headers already sent by (output started at /home/imosigbr/public_html/wp-config.php:96) in /home/imosigbr/public_html/wp-admin/includes/misc.php on line 1196
I followed these tutorials [1]: https://www.wpbeginner.com/wp-tutorials/how-to-fix-missing-a-temporary-folder-error-in-wordpress/ [2]:https://www.wpbeginner.com/beginners-guide/how-to-fix-file-and-folder-permissions-error-in-wordpress/ and although the pictures were not fixed.
Hi the other commenters are right. Go to PHPMyadmin on your control panel and select your database then in the SQL box at the top paste :
UPDATE wp_options SET option_value = replace(option_value, 'http://localhost', 'http://imosigbroker.ro/') WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = replace(guid, 'http://www.localhost','http://imosigbroker.ro/');
UPDATE wp_posts SET post_content = replace(post_content, 'http://localhost', 'http://imosigbroker.ro/');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'http://localhost','http://imosigbroker.ro/');
then click run. It will do a proper job of updating your URLS throughout the site.
My wordpress uploads folder is structured in the default way (year/month)
I have successfully changed the uploads directory location.
But the problem is that I have 10000+ posts and I am looking for a solution so that I can also move the existing medias to the the new location.
I know doing this will also require me to change the path of the medias at the database level.
Does any one know any plugin or script for doing so.
Thanks.
There are a couple of different options mentioned here, most of them are either using an already configured plugin, or running SQL scripts.
Most useful answer that was on that link that I found involved changing the old URLs found on each wp table in your MySQL database
UPDATE wp_options SET option_value = replace(option_value, 'Existing URL', 'New URL')
WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET post_content = replace(post_content, 'Existing URL', 'New URL');
UPDATE wp_postmeta SET meta_value = replace(meta_value,'Existing URL','New URL');
UPDATE wp_usermeta SET meta_value = replace(meta_value, 'Existing URL','New URL');
UPDATE wp_links SET link_url = replace(link_url, 'Existing URL','New URL');
UPDATE wp_comments SET comment_content = replace(comment_content , 'Existing
URL','New URL');
And keep in mind the MySQL replace command can replace part of the URL string, it doesn't have to replace the entire URL string. So in your case, if the original url was
'http://yourdomain.com/wp-content/uploads/2010/10/img.jpg' you could replace the URL as
UPDATE wp_links set link_url = replace(link_url, 'http://yourdomain.com/wp-
content/uploads/2010/10/', 'http://yourdomain.com/wp-content/uploads/') where
link_url like 'http://yourdomain.com/wp-content/uploads/2010/10/%'
You would have to do this for each year and month, but scripting it out this way would be a lot easier than manually updating every URL!
I had a project on localhost, now in wamp I setted virtual domain. Now the local project opens fine on domain address but resource files on pages are not loading. In source code of pages css and js files are still linked with 'localhost' hence are not found.
Its very simple
Edit wp-config.php
define('WP_HOME','http://example.com');
define('WP_SITEURL','http://example.com');
Edit functions.php
and add the line
<?php
update_option('siteurl','http://example.com');
update_option('home','http://example.com');
?>
Take care of permalinks .htacess file & database resources links
You can check here
In your wp-config.php, add these two lines.
define('WP_HOME','sitename/');
define('WP_SITEURL','sitename/');
Also, you need to edit the SQL file to change the resource locations.
I wrote this tutorial which shows you how to do that.
It's here, on my blog.
If you want to maintain your ability to upgrade WordPress in one click, never edit the WordPress core code. Instead, you can use their recommended (clean "drop-in") solution:
Create a new file at /wp-content/db.php with this content:
<?php
/**
* #see http://codex.wordpress.org/Running_a_Development_Copy_of_WordPress
*/
add_filter('pre_option_home', 'test_localhosts');
add_filter('pre_option_siteurl', 'test_localhosts');
function test_localhosts()
{
if (isDevEnvironment($_SERVER)) {
return "http://mysite.local/blog"; //Specify your local dev URL here.
} else {
return false; // act as normal; will pull main site info from db
}
}
/**
* Logic to determine the environment (dev or prod)
* #return bool
*/
function isDevEnvironment($serverArray)
{
return strpos($serverArray['SERVER_NAME'], 'mysite.local') !== false;//Edit this function such that it returns a boolean based on your specific URL naming convention.
}
Now, your local development environment will use its own base URL, and then when you deploy a copy of your codebase to a production environment, it will use its production base URL automatically.
Try this:
You need to change your local links to live links.
For that, Update your database with some query.
:: Queries to change URL for WP Website
UPDATE pvgc_options
SET option_value = replace(option_value, 'http://pleasantviewgarden.hideoutdev.co.uk/',
'http://pleasantviewgardencentre.com/')
WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE pvgc_postmeta
SET meta_value = replace(meta_value, "http://whynickoli.com/", "http://localhost/onestopproperty/");
UPDATE pvgc_posts
SET guid = REPLACE(guid, "http://whynickoli.com/", "http://sparsh-technologies.co.in/megha/onestopproperty/");
UPDATE pvgc_posts
SET post_content = REPLACE(post_content, "http://whynickoli.com/",
"http://sparsh-technologies.co.in/megha/onestopproperty/");
Here you should use your domain.
Thanks!
Edit the wp-config.php settings for a new domain:
define('WP_HOME','siteurl');
define('WP_SITEURL','siteurl');
Search and replace on the database with InterconnectIT Search and Replace Tool. With that tool it's easy to search through the entire database for all occurrences of old domain, and replace that with the name of new domain
my problems started when I moved my website to another folder (from /dev/ to /).
I have gone through the whole database in order to change all the hardcoded /dev/ into / but I still notice that wordpress, somehow, still uses the old values.
Basically the website uses information that are not there anymore.
I checked my own and the server cache and they all seem to be clean (the server doesn't even seem to have that feature on).
So, I am pretty much lost...
When you move a wordpress install, you need to change the site URL throughout your database. To do this you'll need to export your current database via PHP MyAdmin, and then use a tool like:
http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
...to do a search and replace on the entire database.
Search for:
www.yourwebsite.com/dev
replace with:
www.yourwebsite.com
Then import the new database, open your Wordpress site via wp-admin and re-save permalinks.
Run this query in your database
set #oldurl = 'http://oldwp-url.com', #newurl = 'http://newwp-url.com';
UPDATE wp_options SET option_value = replace(option_value, #oldurl, #newurl) WHERE option_name = 'home' OR option_name = 'siteurl';
UPDATE wp_posts SET guid = REPLACE (guid, #oldurl, #newurl);
UPDATE wp_posts SET post_content = REPLACE (post_content, #oldurl, #newurl);
UPDATE wp_posts SET post_content = REPLACE (post_content, CONCAT('src="', #oldurl), CONCAT('src="', #newurl));
UPDATE wp_posts SET guid = REPLACE (guid, #oldurl, #newurl) WHERE post_type = 'attachment';
UPDATE wp_postmeta SET meta_value = REPLACE (meta_value, #oldurl, #newurl);
I have a wordpress script, wp-supercache, that I need to disable (as its cached on a nasty error), however, the error is causing the wp-admin redirect to fail, which means I can't get into the site to disable the plugin.
Any advice? I can access the database via cpanel.
Try re-naming the folder of the plugin and then see if error is gone (make backup first of course.). If that does not help, here is the solution then.
To disable a specific plugin, you have to remove it from the serialized string that stores the list of all plugins - that's set in the option_value column of the wp_options table as discussed by #TimDurden. The specific format change you have to make is, taken shamelessly from teh Internet:
a:4:{
i:0;s:19:"akismet/akismet.php";
i:1;s:36:"google-sitemap-generator/sitemap.php";
i:2;s:55:"google-syntax-highlighter/google_syntax_highlighter.php";
i:3;s:29:"wp-swfobject/wp-swfobject.php";
}
That first set of characters - a:4 - designates an array and its length. Note also that each line in the list of plugins has an index. So:
Decrement the index (from 4 to 3 in this case)
In each line, decrement the number after the i:
Remove the specific plugin you want to disable.
Update the value in the db using the new string you constructed from these steps:
update wp_options set option_value=<new value> where option_id=<id of this option>
Note that your table name might not be wp_options - you might have a prefix to add.
You only need to rename the folder in /wp-content/plugins/ and the plugin will be automatically de-activated. Once it is de-activated, you will be able to login.
Backup database or just the wp_options table
SELECT option_value FROM wp_options WHERE option_name = 'active_plugins';
Copy selected string (serialized string) and paste in the left side at https://serializededitor.com/
Remove the line which plugin you want to deactivate
Copy the serialized result string from the right side and update active_plugins value with it.
UPDATE wp_options
SET option_value = 'THE_NEW_SERIALIZED_STRING'
WHERE option_name = 'active_plugins' LIMIT 1;
I wrote a little exe in .dot to repair/remove options string from database.
Download exe here
Run on MySQL server
SELECT * FROM wp_options WHERE option_name = 'active_plugins';
Paste Results in textbox, press parse.
Remove the ones you don't want.
Click output, it copies output to clipboard
replace brackets inside the single quotes below with output and Run on MySQL server
UPDATE wp_options SET option_value = '[replace inside single quotes with your output' WHERE option_name = 'active_plugins';
No warranties... I don't claim to be programmer
To disable all Wordpress plugins on your site:
Login to your database management tool (e.g. PHPMyAdmin)
Execute the following query:
UPDATE wp_options SET option_value = '' WHERE option_name = 'active_plugins';
Another way to do this is you can backup the site and then just rename the folder of the plugin under /wp-content/plugins/ to some other name . So the plugin will be disabled.
I wont prefer deleting the plugin folder as it may cause errors.
After the step is done log in to your wordpress site and delete the plugin from there
You just need to change the values in the record "active_plugins" in the database. You can find the process Here
Late answer,but answering as it will be useful to someone in the future. All the plugins are stored in the wp_options table in a serialized manner. U can edit this field manually. Or if you unserialize it using a function like in php using unserialize(), you will get an array. just modify it to remove the plugin you want to remove from that array, and serialize it back. then update the table. Thats it. If you want to know more about it here is a good article. It explains all about this.
Using this code you can activate your plugin from the functions.php:
function activate_plugin_via_php() {
$active_plugins = get_option( 'active_plugins' );
array_push($active_plugins, 'unyson/unyson.php'); /* Here just replace unyson plugin directory and plugin file*/
update_option( 'active_plugins', $active_plugins );
}
add_action( 'init', 'activate_plugin_via_php' );