I'm trying to connect my Sub-category post type to a category post type in the following function, but I have this error message : Fatal error: Call to a member function connect() on boolean.
When I echo the $p2p value, it displays "false", but why ?
Anyone could help me ? Thanks!
Import function :
`function import_subCategories(){
global $co;
$query = "SELECT * FROM `tl_events_sous_categories`";
$result = $co->query($query);
while($data = mysqli_fetch_array($result)){
$my_post = array(
'post_title' => iconv('ISO-8859-1','UTF-8', $data['headline']),
'post_content' => '',
'post_status' => 'publish',
'post_author' => 1,
'post_type' => 'sub-categorie'
);
$the_post_id = wp_insert_post($my_post);
// Create the relationship between CATEGORY and SUB CATEGORY
$p2p = p2p_type('sous_categories_categorie');
$p2p->connect($the_post_id, $data['pid'], array('date' => current_time('mysql')));
if(is_wp_error($p2p)){
echo $p2p->get_error_message();
}
}
Hi,
I'm trying to connect my Sub-category post type to a category post type in the following function, but I have this error message : Fatal error: Call to a member function connect() on boolean.
When I echo the $p2p value, it displays "false", but why ?
Anyone could help me ? Thanks!
Import function :
`function import_subCategories(){
}`
Connection types : (in functions.php)
`function my_connection_types() {
}`