TransWikia.com

Create a bulk action to pass user profiles into a CPT

WordPress Development Asked by Zaesar on February 6, 2021

I’m following some questions in stack overflow like this one

Until now and after also reading how to change databases I can’t achieve it.

I want to create a custom post type that displays profile users info, like a single-profile.php. All this I can do. But, can’t pass already all my users (700) into single-channels to show their info as public posts. I’m also not sure how to make it that when there is a new user it passes automatically also into a post.

<?php
function create_channel_page( $user_id = '' ) {
$user = new WP_User($user_id);
if ( ! $user->ID ) return '';

// check if the user whose profile is updating has already a post
global $wpdb;
$channel_post_exists = $wpdb->get_var( $wpdb->prepare(
"SELECT ID FROM $wpdb->posts WHERE post_name = %s AND post_type = 'channels' and post_status 
= 'publish'", $user->user_nicename
) ); ?>

Apreciate your time 🙂

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP