Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6879899
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T04:54:19+00:00 2026-05-27T04:54:19+00:00

I am making a wordpress plugin, and I used a query to get all

  • 0

I am making a wordpress plugin, and I used a query to get all the data I need from the database but afterwards I can’t figure out how to parse it.

My query is:

$dbContent = $wpdb->get_results( "SELECT option_id, option_name, option_value FROM wp_options WHERE option_name LIKE '%Customizer%'" );

and I am showing it using:

$retval .= "<pre>";
        $retval .= print_r($dbContent);
        $retval .= "</pre>";

I get this, what I think is an array of arrays:

Array ( [0] => stdClass Object ( [option_id] => 119587 [option_name] => bfhCustomizer_price_1 [option_value] => 2.85 ) [1] => stdClass Object ( [option_id] => 119584 [option_name] => bfhCustomizer_option1 [option_value] => Leave-In Moisturizer ) [2] => stdClass Object ( [option_id] => 119585 [option_name] => bfhCustomizer_option2 [option_value] => Conditioner/Cleansing Conditioner ) [3] => stdClass Object ( [option_id] => 119586 [option_name] => bfhCustomizer_option3 [option_value] => Pure Oil Mixture ) [4] => stdClass Object ( [option_id] => 119588 [option_name] => bfhCustomizer_price_2 [option_value] => 3.45 ) [5] => stdClass Object ( [option_id] => 119589 [option_name] => bfhCustomizer_price_3 [option_value] => 1.99 ) [6] => stdClass Object ( [option_id] => etc...

Could someone tell me how to properly access this? I was trying to use something like $dbContent->option_id or $dbContent['option_id']but neither worked and I’m lost here now

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T04:54:19+00:00Added an answer on May 27, 2026 at 4:54 am

    It looks like you have an array of stdClass objects, so you can access it like this:

    $id = $dbContent[0]->option_id;
    
    // or in a loop
    
    foreach($dbContent as $index => $result) {
        echo $result->option_id;
        echo $result->option_name;
        // etc
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm making a plugin that does a custom query on the WordPress database, and
wpdb class in wordpress is used for making connection to database. is there any
Hi I am making a wordpress plugin where I need the Admin to enter
So I'm making a plugin to output facebook data onto wordpress websites, the way
I need help making a search query for comments (it's for a WordPress site).
I am making a Vimeo Upload plugin for Wordpress, so that you can upload
im making a wordpress plugin and i have a function where i import images,
I am currently in the process of making a WordPress Plugin which is going
I am making a plugin which is called directly, from AJAX or similar. I'm
I just started the Plugin development for the Wordpress, but finding it little difficult

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.