Skip to content

Instantly share code, notes, and snippets.

WordPress doesn't allow multiple users to share the same e-mail address, but there are certain plugins that change that behavior. This is an example workaround using the Allow Multiple Accounts plugin.

  1. Install and activate this plugin: https://wordpress.org/plugins/allow-multiple-accounts/

  2. Use a custom PHP function in the import to generate a fake e-mail for the imported user(s): [fake_email()]. Screenshot: https://d.pr/FREE/Yr0MOL.

  3. Store the real e-mail in a Custom Field named '_email_temp'. Screenshot: https://d.pr/ERw4F9

  4. Use our API to change the users e-mail to the real e-mail after the user is saved.

@mbissett
mbissett / query_cyrillic_attribute_values.md
Created August 29, 2020 03:49 — forked from trey8611/query_cyrillic_attribute_values.md
WP All Import - use XPath Query based on Cyrillic attribute value

XPath doesn't allow you to make queries with Cyrillic symbols unless you disable XML pre-processing by adding this code in your child themes functions.php file (or in a plugin like Code Snippets: https://wordpress.org/plugins/code-snippets/):

function wpai_is_xml_preprocess_enabled( $is_enabled ) {
	return false;
}
add_filter( 'is_xml_preprocess_enabled', 'wpai_is_xml_preprocess_enabled', 10, 1 );

Once that code is in place, upload your file to an import and queries like this will be possible:

<?php
/*
################### READ ME #################################
You'll pass the URL to your feed/file to this function inside the "Download from URL" option when creating an import.
Image examples: https://d.pr/hCfNek and https://d.pr/MnerNb.
1. [custom_file_download("ftp://username:[email protected]/full/path/to/file.csv","csv")]
2. [custom_file_download("http://example.com/full/path/to/file.csv","csv")]
@mbissett
mbissett / Import Types.md
Last active April 27, 2021 11:07 — forked from trey8611/Import Types.md
WP All Import - Import Types

A description of import types

  • New Items Import -

This is primarily used to create and manage products. It keeps internal track of the products that it imports, which means that it can later update/create/delete products as they're changed/added/removed in your import file. It's also the only import type that can add/remove variations for variable products.

One limitation of new items imports is that cannot detect/update products that it didn't previously create. If you need to use a "New Items" import with a file that contains existing products, you can use WP All Import's API to prevent duplicates from being imported: https://www.wpallimport.com/documentation/developers/code-snippets/#do-not-create-products-with-duplicate-sku.

@mbissett
mbissett / gist:276dffed1de57b523c8b7ebd0967676a
Last active January 14, 2018 00:29
Update embedded images in imported post content
<?php
// Hat tip to Trey Mills for the original code inspiration
add_action('pmxi_saved_post', 'update_images_in_post_content', 10, 3);
function update_images_in_post_content($id) {
$media = get_attached_media( 'image', $id );