my website is : http://designspicy.com/ i am try to retrive all post from wordpress and insert into a custom table but it always insert null value why
my code is here
<?php
global $post;
$args = array( 'numberposts' => -1 );
$myposts = get_posts( $args );
foreach ( $myposts as $post ) :
setup_postdata( $post );
insert_p_now(the_permalink());
endforeach;
wp_reset_postdata();
function insert_p_now($a)
{
global $wpdb;
$wpdb->insert('wp_posttable', array('post_title' => $a), array('%s'));
}
?>