Where are the mysql tables where "custom field" data is stored - how to query "custom

Hi, I am absolute new to WPMU DEV and bought a membership mainly because of the "CustomPress" plugin (of which I thought would be a Theme! - guess, I did not read all the information carefully enough and still lack some understanding of the English language). To me the "examples" are a bit misleading for it is mentioned CustomPress is suited for building a "movies database" or referring to "book database". Me naive, have already promised a client to "program" a real-estate application for him (having your showcase "RealEstate - CustomPress" example in mind) - with WordPress as foundation, silly me! Long story short, I cant find any information of this plugin that relates to data storage,not to mention data retrival! Not even some basic data search functionality seems to be available with this plugin - you are mentioning a "real-estate" application that "heavily relies on the CustomPress" plugin and use this as an example of the capabillity...? Wow, thought, most of the search functionality of this real-estate site would had been done with the CustomPress plugin?! So now I am not only frustrated, I also can not find any information where the data of "custom fields" for exmaple are stored, so I could get my hands on them... Do I have to start coding with bare PHP and MYSQL and forget all about the easy to use plugin stuff? Please give me a hint!

  • Hakan

    Hi Stylos, aecnu,

    I think Stylos is expecting a more technical answer.

    In general a custom post type is not so much different than an ordinary Wordpress post. Main difference between a post is its post_type field in the DB being "post", but for a custom post it is something like "movie",

    You can access the custom post by its ID which is unique for posts or custom posts. This means given a post ID, it cannot be post and custom post at the same time. So for example if you want to display a custom field of a known custom post, you simply use the ID like so:

    // Get the custom field movie_title for post ID 17
    $movie_title = get_post_meta( 17, "movie_title", true );

    In general whatever you can do for a post is also valid for a custom post type, with some rare exceptions (e.g. sticky posts).

    Cheers,
    Hakan

  • Stylos

    Hello aecnu, thanks for acknowleding my question. Although I´ve just started and only have "newbies status" when it comes to WordPress, I know data is stored in the tables of the database - also had a look at the tables but could not find any "fieldnames" or data related to the "custom fields" I am using with the "custom post type" I´ve generated with the "CustomPress" plugin.

    Also thank you very much Hakan, for getting back on this so fast and letting me have your usefull answer. Yes, you are absolutely right, I was expecting a "more" technical answer and I am glad you related to that. It will take me some time to think about and understand what you have written and make use of the given code. Appreciate that very much!
    I was expecting the plugin would allow me to do some "kind of database query" - something like: "SELECT ALL posts FROM table_where_wp_keep_the_posts_in WHERE my_custom_field = 'my_search_value' ".
    As said, I am new to WordPress "programing" and this might be naive thinking. In the "Showcase" WPMU DEV refers to a "real estate" blog that uses the CustomPress plugin. I had a look at the URL and there you can search for houses by chosing certain search criteria; so I initially thought that would be the main functionality of the plugin - provide an WP interface to input "new" data-types (like text, numeric fields and even fields to use png or jpg files) and of course provide a search functionality in order to retrive the data (and limit the search to certain given conditions).
    By the way, there is a plugin "saying" it can all do that; build a real estate blog with search functionality, showing and formating fotos and so on - without programing; unfortunately not from WPMU DEV. It´s called WP-Types. Have not tried it, but what they are writing about their plugin describes clearly such functionality and the demo speaks for itself. Well...

    I am pretty sure I will make the best out of "elite" membership, think that it still was the right decision to do and it will certainly pay off in the future! But - concerning the description of the plugin and what it can really do (as a newbie) I would appreciate to have more precise information about its abilities; otherwise it really is somewhat misleading to me and could be taken for some kind of tricky "marketing hype" stuff to my mind!