Home>Article>CMS Tutorial> How to communicate data between two wordpresses

How to communicate data between two wordpresses

爱喝马黛茶的安东尼
爱喝马黛茶的安东尼 Original
2019-07-15 14:36:03 3188browse

How to communicate data between two wordpresses

First of all, find the data table prefix of the main station. It must be that station A is established first, and then the second station B is established. Station B wants to share the users of station A, then Open the wp_config.php file of station B, and then insert the following code:

define('CUSTOM_USER_TABLE', 'wp_users'); define('CUSTOM_USER_META_TABLE', 'wp_usermeta');

This place must be copied directly to avoid character errors. Copy it to a location with the same format, and then the data users will be common, but use A When logging in to Station B with your website account, you will see this prompt:

How to communicate data between two wordpresses

Related recommendations: "WordPress Tutorial"

This requires two steps , the first step is to execute the following statement in phpmyadmin:

INSERT INTO `dbname`.`wp_usermeta` (`umeta_id`, `user_id`, `meta_key`, `meta_value`) VALUES (NULL, '1', 'wpen_capabilities', 'a:1:{s:13:"administrator";s:1:"1";}');

The second step is to make a plug-in, the specific code is as follows:

 0 ) { foreach( $addi_prefixs as $prefix ) { add_user_meta( $user_id, $prefix.'capabilities', $cap_val, true ); } } } } ?>

Completely copy and save as userdb.php and then upload the plug-in directory Just enable it.

The above is the detailed content of How to communicate data between two wordpresses. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn