How to get values of multiple nested arrays in PHP? - php

This is a shorter version of my question from How to get values only from a PHP array inside multiple nested Arrays without knowing value? so hoping someone can help.
MAIN ISSUE I don't know what to call to get things inside ARRAY
What I need is inside that Array of Extras. I've duplicated & modified everything I can to get these values but can't seem to figure it out. Any help is really appreciated.
The registration, milage, condition shown is the output of $autoshowroom_portfolio_specifications_arr
array (
'label' => __( 'Checkboxes field', 'progression-car-dealer' ),
'name' => 'pcd_checkboxes',
'display' => 'table',
'min' => '',
'max' => '',
'sub_fields' => array (
array (
'key' => 'field_52816dc9ffee11',
'label' => __( 'Checkboxes to Customize', 'progression-car-dealer' ),
'name' => 'pcd_checkboxes',
'type' => 'checkbox',
'instructions' => __( 'Selected fields will be used', 'progression-car-dealer' ),
'choices' => $choices,
'default_value' => '',
'layout' => 'horizontal',
)
),
),
More code
array(
'id' => 'autoshowroom_Detail_show_extras',
'label' => esc_html__('Show Extras', 'autoshowroom'),
'desc' => '',
'sdt' => 'yes',
'type' => 'select',
'section' => 'TZVehicleDetail',
// 'section' => 'TZVehicle',
'choices' => array(
array(
'value' => 'yes',
'label' => esc_html__('Show', 'autoshowroom'),
),
array(
'value' => 'no',
'label' => esc_html__('Hide', 'autoshowroom'),
)
)
),
$car_extras = array_unique( array_merge( array (
__( 'Auxiliary heating', 'progression-car-dealer' ),
__( 'ABS', 'progression-car-dealer' ),
__( 'Central locking', 'progression-car-dealer' ),
__( 'Power Assisted Steering', 'progression-car-dealer' ),
__( 'Cruise control', 'progression-car-dealer' ),
__( 'Immobilizer', 'progression-car-dealer' ),
__( 'Warranty', 'progression-car-dealer' ),
__( 'Electric windows', 'progression-car-dealer' ),
__( 'Financing', 'progression-car-dealer' ),
__( 'Another', 'progression-car-dealer' ),
__( 'Last', 'progression-car-dealer' ),
), $this->get_meta_values( 'extras', 'vehicle' ) ));
$car_extras = array_combine( $car_extras, $car_extras);
More code
public function register_field( $args ) {
// ACF requires a unique key per field so lets generate one
$key = md5( serialize( $args ));
if ( empty( $args['type'] )) {
$args['type'] = 'number';
}
$type = $args['type'];
if ( 'taxonomy' == $type ) {
$field = wp_parse_args( $args, array(
'key' => $key,
'label' => '',
'name' => '',
'type' => 'taxonomy',
'instructions' => '',
'taxonomy' => '',
'field_type' => 'select',
'allow_null' => 1,
'load_save_terms' => 1,
'return_format' => 'id',
'multiple' => 0,
'sort' => 0,
'group' => 'overview'
) );
} else if ( 'radio' == $type ) {
$field = wp_parse_args( $args, array (
'key' => $key,
'label' => '',
'name' => '',
'instructions' => '',
'choices' => array(),
'other_choice' => 1,
'save_other_choice' => 1,
'default_value' => '',
'layout' => 'horizontal',
'sort' => 0,
'group' => 'specs'
) );
} else if ( 'checkbox' == $type ) {
$field = wp_parse_args( $args, array (
'key' => $key,
'label' => '',
'name' => '',
'instructions' => '',
'choices' => array(),
'layout' => 'vertical',
'sort' => 0,
'multiple' => 1,
'group' => 'specs'
) );
} else {
$field = wp_parse_args( $args, array (
'key' => $key,
'label' => '',
'name' => '',
'type' => 'number',
'instructions' => '',
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'min' => 0,
'max' => '',
'step' => '',
'sort' => 0,
'group' => 'specs'
) );
}
$field = apply_filters( 'pcd/register_field', $field );
$this->fields[$field['name']] = $field;
More code
'extras' => array(
'label' => __( 'Extras', 'progression-car-dealer' ),
'name' => 'extras',
'type' => 'checkbox',
'choices' => $car_extras,
'other_choice' => 55,
'save_other_choice' => 55,
'default_value' => '',
'layout' => 'horizontal',
'sort' => 95,
),

Related

post_object fields don't work any more after including ACF

After I included ACF into my Plugin fields of type 'user' and 'post_object' don't work any more. They worked perfectly fine before I included ACF. They are displayed but they don't show me any options any more. Any clue what this might have caused? I guess that some link might have changed but I can't find any hint to that in the code:
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_5f65057cd8301',
'title' => 'Employees Details',
'fields' => array(
array(
'key' => 'field_5f8a0c6792e45',
'label' => 'Display Name',
'name' => 'display_name',
'type' => 'user',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'role' => array(
0 => 'employee',
1 => 'administrator',
),
'allow_null' => 0,
'multiple' => 0,
'return_format' => 'array',
),
array(
'key' => 'field_5f65089dbbe1d',
'label' => 'Occupation',
'name' => 'occupation',
'type' => 'post_object',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'post_type' => array(
0 => 'occupations',
),
'taxonomy' => '',
'allow_null' => 0,
'multiple' => 0,
'return_format' => 'object',
'ui' => 1,
),
array(
'key' => 'field_5f8b42ca6c4c6',
'label' => 'Costs per Hour',
'name' => 'costs_per_hour',
'type' => 'number',
'instructions' => 'Enter a number with max 2 decimals, separated by ".", e.g. "35.46"',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'min' => '',
'max' => '',
'step' => '0.01',
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'employees',
),
),
),
'menu_order' => 0,
'position' => 'acf_after_title',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => true,
'description' => '',
));
endif;
In the meantime I found this:
In the console there are errors as these:
Failed to load resource: the server responded .../advanced-custom-fields/assets/css/acf-global.css?ver=5.9.1
ReferenceError:Can't find variable: acf Global Code post-new.php 1972
(actually my post-new.php doesn't even have so many lines)
When I click on the last one the debugger gives me this:
acf.data = {"postboxes":[{...
acf.doAction( 'prepare' )
And when I finally look into the apache_error.log there are errors like:
File does not exist: /Applications/MAMP/htdocs/myPlugin/Applications, referrer: http://localhost:8888/myPlugin/wp-admin/post-new.php?post_type=jobs

WP ACF Generate php – Where and how to put the code?

On my WordPress website I have the ACF plugin installed and I'm using the fields on several pages in the 'regular' way. So I created the groups and fields in the backend. Everything works fine.
Now I want to generate php code of a couple of those field groups (because I want to change the code slightly). Where do I put the code and what’s the best way to do this?
I've created a new php file acf-deals.php and uploaded it to the /php-includes/ directory in the root directory. It includes the following code:
<?php
if( function_exists('acf_add_local_field_group') ):
acf_add_local_field_group(array(
'key' => 'group_deal1',
'title' => 'Deal One (displayed on homepage)',
'fields' => array(
array(
'key' => 'field_5c66e017f8359',
'label' => 'Title',
'name' => 'deal_title_one',
'type' => 'text',
'instructions' => '(max. 100 characters)',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => 'deals-title',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '',
'append' => '',
'maxlength' => 100,
),
array(
'key' => 'field_5c6d43781bcb1',
'label' => 'Deal or Discount',
'name' => 'discount_deal_or_special_one',
'type' => 'radio',
'instructions' => '',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5c66e017f8359',
'operator' => '!=empty',
),
),
),
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array(
'Discount' => 'Discount',
'Deal' => 'Deal',
),
'allow_null' => 1,
'other_choice' => 0,
'default_value' => '',
'layout' => 'vertical',
'return_format' => 'value',
'save_other_choice' => 0,
),
array(
'key' => 'field_5c66e094f835a',
'label' => 'Description',
'name' => 'deal_description_one',
'type' => 'textarea',
'instructions' => '(max. 600 characters)',
'required' => 0,
'conditional_logic' => array(
array(
array(
'field' => 'field_5c66e017f8359',
'operator' => '==empty',
),
),
),
'wrapper' => array(
'width' => '',
'class' => 'deals-description',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'maxlength' => 600,
'rows' => '',
'new_lines' => '',
),
array(
'key' => 'field_5c66e0d4f835b',
'label' => 'Regular price',
'name' => 'regular_price_one',
'type' => 'number',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => 'deals-regular-price',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '$',
'append' => '',
'min' => '',
'max' => '',
'step' => '',
),
array(
'key' => 'field_5c66e130f835c',
'label' => 'Discounted price / deal price',
'name' => 'discounted_price_one',
'type' => 'number',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => 'deals-discounted-price',
'id' => '',
),
'default_value' => '',
'placeholder' => '',
'prepend' => '$',
'append' => '',
'min' => '',
'max' => '',
'step' => '',
),
array(
'key' => 'field_5c703c1fd5851',
'label' => 'Valid until',
'name' => 'valid_until_one',
'type' => 'date_picker',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
),
'display_format' => 'm/d/Y',
'return_format' => 'm/d/Y',
'first_day' => 1,
),
),
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'post',
),
array(
'param' => 'post_format',
'operator' => '==',
'value' => 'aside',
),
),
array(
array(
'param' => 'post_format',
'operator' => '==',
'value' => 'status',
),
),
),
'menu_order' => 1,
'position' => 'acf_after_title',
'style' => 'default',
'label_placement' => 'top',
'instruction_placement' => 'label',
'hide_on_screen' => '',
'active' => 1,
'description' => '',
));
endif;
?>
I've added this code to my single-aside.php file:
<?php get_template_part( '/php-includes/acf-deals.php', 'acf-deals' ); ?>
Unfortunately the field are not showing up in the WP admin backend. What am I doing wrong? I searched and searched but can't find a proper explanation or a way to fix it. I hope someone can help.
Thanks for your help!
add_action('acf/init', function(){
... add local fields
})

How to wrap hardcoded array in PHP?

I want to separate some part of my arrays so I can make the details dynamic and different in my WordPress website.
I'm using ACF to get my custom post type taxonomy and trying to generate some attributes and make them tabs using the acf_add_local_field_group function but unfortunately am not able to make it work.
The reason why I want to separate the array is because am not able to call global $post; and I have a function which is a meta box for that to retrieve the taxonomy terms.
Here is my code:
function my_acf_add_local_field_groups()
{
acf_add_local_field_group(array(
'key' => 'tab_group_1',
'title' => 'Product Sizes and Prices',
'name' => 'group_sizes_tab',
'fields' => array(
array(
'key' => 'field_tab_size_1',
'label' => 'First Size',
'name' => 'store_sizes_',
'type' => 'tab',
'parent' => 'tab_group_1',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
) ,
'collapsed' => '',
'min' => '',
'max' => '',
) ,
array(
'key' => 'field_unique_key',
'label' => 'Simple Repeater',
'name' => 'simple_repeater',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
) ,
'collapsed' => '',
'min' => 0,
'max' => 10,
'layout' => 'table',
'button_label' => 'Add row',
'sub_fields' => array(
array(
'key' => 'field_unique_key_1',
'label' => 'Total Products',
'name' => 'total_products',
'type' => 'text',
) ,
array(
'key' => 'field_unique_key_2',
'label' => 'Total Prices',
'name' => 'total_prices',
'type' => 'text',
) ,
) ,
) ,
array(
'key' => 'field_tab_size_2',
'label' => 'Second Size',
'name' => 'store_sizes_2',
'type' => 'tab',
'parent' => 'tab_group_1',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
) ,
'collapsed' => '',
'min' => '',
'max' => '',
) ,
) ,
'location' => array(
array(
array(
'param' => 'post_type',
'operator' => '==',
'value' => 'products',
) ,
) ,
) ,
));
}
add_action('acf/init', 'my_acf_add_local_field_groups');
As you can see in the group_sizes_tab the fields value is the one I want to separate. Am thinking storing it in a variable but when I tested it it doesn't work.
Just to make it short, basically outside the function it'll be like this:
$fields = array(
'key' => 'field_tab_size_1',
'label' => 'First Size',
'name' => 'store_sizes_',
'type' => 'tab',
'parent' => 'tab_group_1',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array(
'width' => '',
'class' => '',
'id' => '',
) ,
'collapsed' => '',
'min' => '',
'max' => '',
);
Then I replace this value inside the function but it is not working.
How can I wrap the array and replace it with a variable in the function?

Add category automatically while adding post

I am using wordpress for a News site.
There is place called Headlines with following ACF code. Which adds posts to headline of the website.
array (
'key' => 'field_53e3e2fc67dc4',
'label' => 'Headlines',
'name' => 'hp_headlines',
'prefix' => '',
'type' => 'repeater',
'instructions' => '',
'required' => 0,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'min' => '',
'max' => '',
'layout' => 'row',
'button_label' => 'Add Headline',
'sub_fields' => array (
array (
'key' => 'field_54621f720bfdc',
'label' => 'Headline Type',
'name' => 'hp_headline_type',
'prefix' => '',
'type' => 'radio',
'instructions' => '',
'required' => 1,
'conditional_logic' => 0,
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'choices' => array (
'url' => 'URL',
'article' => 'Article',
),
'other_choice' => 0,
'save_other_choice' => 0,
'default_value' => 'url',
'layout' => 'horizontal',
),
array (
'key' => 'field_54621fa20bfdd',
'label' => 'URL',
'name' => 'hp_headline_url',
'prefix' => '',
'type' => 'url',
'instructions' => '',
'required' => 1,
'conditional_logic' => array (
array (
array (
'field' => 'field_54621f720bfdc',
'operator' => '==',
'value' => 'url',
),
),
),
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'default_value' => '',
'placeholder' => 'http://',
),
array (
'key' => 'field_53e3e34067dc5',
'label' => 'Article',
'name' => 'hp_headline_article',
'prefix' => '',
'type' => 'post_object',
'instructions' => '',
'required' => 1,
'conditional_logic' => array (
array (
array (
'field' => 'field_54621f720bfdc',
'operator' => '==',
'value' => 'article',
),
),
),
'wrapper' => array (
'width' => '',
'class' => '',
'id' => '',
),
'post_type' => array (
0 => 'post',
),
'taxonomy' => '',
'allow_null' => 0,
'multiple' => 0,
'return_format' => 'id',
'ui' => 1,
),
),
Which creates a field to add already added posts to a list of headlines.
Now I want these fields to be added to category "xyz" automatically as I press the update button. And I have no Idea which file to edit.
You need use save_post action, add this code in your functions.php change cat ID wit your cat id's
function set_my_categories($post_ID){
if(wp_is_post_autosave($post_ID) || wp_is_post_revision($post_ID)) {
return $post_ID;
}
wp_set_post_categories( $post_ID, array(49,13) );
}
add_action('save_post', 'set_my_categories');

fetch all row values with same user id in php?

I am working on wordpress website and i just stuck over one sql query.
I need to get the values from database table which contain same user id.
here is my table:
And when i run select query in mysql it is fetching result correct:
But i dont know how to get this result in my php template.
this is my query i am using in php:
$current_user = wp_get_current_user();
$id=$current_user->ID;
$skill1 =mysql_query("SELECT Skills FROM wp_candidate_skills WHERE user_id='{$id}' ");
I cant use get->result because it is showing error that get->result must contain object. Something like this error is.
This is what i am using after Mysql_query:
$arr = mysql_fetch_array($skill1);
print_r($arr);
And the Output is:
Wordpress code:
public static function init_fields() {
if ( self::$fields )
return;
$current_user = wp_get_current_user();
$user = $current_user->user_login;
$useremail = $current_user->user_email;
$id=$current_user->ID;
$skill1 =mysql_query("SELECT ID,user_id,Skills FROM wp_candidate_skills WHERE user_id=$id");
$skill_note = mysql_fetch_array($skill1);
$result = mysql_query("SELECT * FROM wp_candidate_details WHERE user_id='{$id}' LIMIT 1");
$expe_note = mysql_fetch_assoc($result);
$job_title = $expe_note['job-cat1'];
$user_loc = $expe_note['location_one_id'];
$row_num = mysql_query("SELECT COUNT(Skills) FROM wp_candidate_skills WHERE user_id='{$id}' " );
$row_cnt = mysql_fetch_array($row_num);
$arr = mysql_fetch_array($skill1);
print_r($arr);
mysql_free_result($skill1);
$skill_area = $skill_note['Skills'];
self::$fields = apply_filters( 'submit_resume_form_fields', array(
'resume_fields' => array(
'candidate_name' => array(
'label' => __( 'Your name', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => __( 'Your full name', 'wp-job-manager-resumes' ),
'priority' => 1,
'value' => $user
),
'candidate_email' => array(
'label' => __( 'Your email', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => __( 'you#yourdomain.com', 'wp-job-manager-resumes' ),
'priority' => 2,
'value' => $useremail
),
'candidate_title' => array(
'label' => __( 'Professional title', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => __( 'e.g. "Web Developer"', 'wp-job-manager-resumes' ),
'priority' => 3,
'value' => $job_title
),
'candidate_location' => array(
'label' => __( 'Location', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => __( 'e.g. "London, UK", "New York", "Houston, TX"', 'wp-job-manager-resumes' ),
'priority' => 4,
'value' => $user_loc
),
'resume_skills' => array(
'label' => __( 'Skills', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => false,
'placeholder' => __( 'Comma separate a list of relevant skills', 'wp-job-manager-resumes' ),
'priority' => 9,
'value' => $skill_area
),
'links' => array(
'label' => __( 'URL(s)', 'wp-job-manager-resumes' ),
'type' => 'links',
'required' => false,
'placeholder' => '',
'description' => __( 'Optionally provide links to any of your websites or social network profiles.', 'wp-job-manager-resumes' ),
'priority' => 10,
'fields' => array(
'name' => array(
'label' => __( 'Name', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => '',
'priority' => 1
),
'url' => array(
'label' => __( 'URL', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => 'http://',
'priority' => 2
)
)
),
'candidate_education' => array(
'label' => __( 'Education', 'wp-job-manager-resumes' ),
'type' => 'education',
'required' => false,
'placeholder' => '',
'priority' => 11,
'fields' => array(
'location' => array(
'label' => __( 'School name', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => ''
),
'qualification' => array(
'label' => __( 'Qualification(s)', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => ''
),
'date' => array(
'label' => __( 'Start/end date', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => ''
),
'notes' => array(
'label' => __( 'Notes', 'wp-job-manager-resumes' ),
'type' => 'textarea',
'required' => false,
'placeholder' => ''
)
)
),
'candidate_experience' => array(
'label' => __( 'Experience', 'wp-job-manager-resumes' ),
'type' => 'experience',
'required' => false,
'placeholder' => '',
'priority' => 12,
'fields' => array(
'employer' => array(
'label' => __( 'Employer', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => ''
),
'job_title' => array(
'label' => __( 'Job Title', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => ''
),
'date' => array(
'label' => __( 'Start/end date', 'wp-job-manager-resumes' ),
'type' => 'text',
'required' => true,
'placeholder' => ''
),
'notes' => array(
'label' => __( 'Notes', 'wp-job-manager-resumes' ),
'type' => 'textarea',
'required' => false,
'placeholder' => ''
)
)
),
'resume_file' => array(
'label' => __( 'Resume file', 'wp-job-manager-resumes' ),
'type' => 'file',
'required' => false,
'description' => sprintf( __( 'Optionally upload your resume for employers to view. Max. file size: %s.', 'wp-job-manager-resumes' ), size_format( wp_max_upload_size() ) ),
'priority' => 13,
'placeholder' => ''
),
)
) );
if ( ! get_option( 'resume_manager_enable_resume_upload' ) )
unset( self::$fields['resume_fields']['resume_file'] );
if ( ! get_option( 'resume_manager_enable_categories' ) || wp_count_terms( 'resume_category' ) == 0 )
unset( self::$fields['resume_fields']['resume_category'] );
if ( ! get_option( 'resume_manager_enable_skills' ) )
unset( self::$fields['resume_fields']['resume_skills'] );
}
Help me out guys! Thanks
Try this code, `$skill1 = $wpdb->get_results("SELECT ID,user_id,Skills FROM wp_candidate_skills WHERE user_id='$id'");
$count = count($skill1);
$array = array();
foreach ($skill1 as $key => $value) {
$sk = $value->Skills;
$array[] = $sk;
}
$fixId =array();
$fixId[0] ='';
for($i=0;$i<=$count-1;$i++)
{
$temp = $array[$i];
$fixId[0] = $fixId[0].$temp.',';
}
$data = $fixId[0] ;
$words = array_filter(preg_split('/\s*,\s*/', $data));
$temp = implode(', ', $words);`
It will fetch data as an array with comma inserted between two values.
Use get_results like below:
<?php
global $wpdb; //important
$result = $wpdb->get_results("SELECT Skills FROM wp_candidate_skills WHERE user_id='$id' ");
foreach($result as $row)
{
echo $row->Skills."<br>";
}
Display mysql table data in a wp page
Use the code like below:
public static function init_fields() {
if ( self::$fields )
return;
global $wpdb;
$current_user = wp_get_current_user();
$user = $current_user->user_login;
$useremail = $current_user->user_email;
$id=$current_user->ID;
$result = $wpdb->get_results("SELECT ID,user_id,Skills FROM wp_candidate_skills WHERE user_id=$id");
print_r($result);
die();
}
Try this way
$current_user = wp_get_current_user();
$id=$current_user->ID;
$skill1 =mysql_query("SELECT Skills FROM wp_candidate_skills WHERE user_id='".$id."' ");
$arr = mysql_fetch_array($skill1);
print_r($arr);

Categories