Last active
April 15, 2020 15:18
-
-
Save hasinhayder/1035dae4403bf2a67f92abd2690fd427 to your computer and use it in GitHub Desktop.
posts using wpdb
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
global $wpdb; | |
$_posts = $wpdb->get_results("SELECT ID, post_title from {$wpdb->prefix}posts WHERE post_status='publish' and post_type='post'",ARRAY_A); | |
$p = []; | |
foreach($_posts as $_post){ | |
$p[$_post['ID']] = $_post['post_title']; | |
} | |
//now pass this $p array to carbon field's set_option() function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment