• Resolved Zrenjaninac

    (@zrenjaninac)


    I have a google sheet with columns.
    I would like to import data and create new pages, but page must be password protected and I have one column with passwords that I would like to be set.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author WP All Import

    (@wpallimport)

    Hi @zrenjaninac

    I would like to import data and create new pages, but page must be password protected and I have one column with passwords that I would like to be set.

    Currently this would require a custom code workaround. You would need to import your password element into a custom field, e.g.: https://d.pr/i/0Mr9dM, then use our pmxi_saved_post hook to set it as the post password:

    add_action( 'pmxi_saved_post', 'my_set_pass', 10, 1 );
    
    function my_set_pass( $id ) {
    	$pass = get_post_meta( $id, '_my_post_pass', true );
    	$args = array(
    		'ID' => $id,
    		'post_password' => $pass
    	);
    	
    	wp_update_post( $args );
    }

    Learn more about our API here: https://www.wpallimport.com/documentation/developers/action-reference/.

    Thread Starter Zrenjaninac

    (@zrenjaninac)

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Import password protected pages’ is closed to new replies.