Profile cover photo
Profile photo
Richard van Naamen
IT Professional, Systems Administrator, MCP, Webdesigner, Wordpress Lover
IT Professional, Systems Administrator, MCP, Webdesigner, Wordpress Lover


Post has attachment

Post has attachment
Hi Guys and Girls,

I have a question:
I am developing a custom wordpress intranet site with some custom fields.
Let me explain the situation:
I want to display an overview of the cranes and their maintenance status. I f there is a crane that needs repair then i want users to be able to edit (when is logged in) the crane and send an email after the changes.
I have created a custom post type: called "Cranes" (supports title only)
With the following custom fields: Status, Time, Quay, Rows, Description and Extra info.

This is what it looks likes (its in dutch btw)
So far so good. I also created a page with the overview of all cranes.
(see picture 2)
Now when someone clicks on the crane name (link is only available when logged in and have the proper rights) in the overview page they are taken to a details page / form where they can edit any field/ info for that specific crane.
That all works fine. I have all the info in the form.

What I need help with is the actual SQL update statement in my custom page with the form. So I need to update the corresponding rows in wp_postmeta table where crane_id = post_id

What I have so far is the following code: 
$kraanid = get_query_var('kraanid');
if ($kraanid == "") {
header("Location: http://localhost/wp-test/kranen");
$datum = date("d-m-Y");

// Get Kranen where postid = url id
$args = array (
  'post_type'              => array( 'kranen' ),
'p'                      => $kraanid,

$kranen = new WP_Query( $args ); 

// Update statement in table 
if (isset($_POST['update'] )) {
global $wpdb;
// Declare form variables
$FormNaam = $_POST['Naam'];
$FormDatum = $_POST['Datum'];
$FormStatus = $_POST['Status'];
$FormTijd = $_POST['Tijd'];
$FormRijen = $_POST['Rijen'];
$FormOpm = $_POST['Opm'];

$table = 'wp_postmeta' ;

$where = array('post_id' => $kraanid, 'meta_key' => 'ingevuld_door');
   $where2 = array('post_id' => $kraanid, 'meta_key' => 'opmerkingen');
$where3 = array('post_id' => $kraanid, 'meta_key' => 'rijen');

// update fields
$wpdb->update( $table, array('meta_value' => $FormNaam), $where);
   $wpdb->update( $table, array('meta_value' => $FormOpm), $where2);
$wpdb->update( $table, array('meta_value' => $FormRijen), $where3);
if($result > 0){
header("Location: http://localhost/wp-test/kranen");
} else {
exit( var_dump( $wpdb->last_query ) );
header("Location: http://localhost/wp-test/kranen");


With this code only the name field is updated  not the other fields.
I would like to do this update in one sql statement I know its possible but can get my head around it.

see table and rows in screenshot.

Many thanks in advance
4 Photos - View album

Post has attachment
Search Replace DB version 3.1.0 was just released! It allows you to carry out database wide search/replace actions that don’t damage PHP serialized strings or objects with a user friendly interface and experience.

Post has attachment

Post has attachment
Read about the new improvements to the website

Post has attachment
taking the functionality you'd normally put in the `functions.php` file and moving it out into a "functionality plugin".

Post has attachment

Post has attachment

Post has attachment
Anyone have any idea why Gravity Forms plugins (latest version 1.8.8.
) slows down the entire back-end of #wordpress, but not the front-end?
I have it running on a standard 2012 theme with a custom child theme.

I have tried the following already:
1. Disabling all plugins (except for the GF Plugin)
2. Switching themes.
3. Deleting the GF Plugin and reinstalling it.
4. installing P3 (but that did not run... got a blank results page )
3. Checking dev tools to see whats happening beneath the surface and it just takes 30 seconds or so to load the page. Then looking at the file that reports the long wait: ../wp-admin/plugins.php. But that does not tell me anything.

If I disable GF Plugin it all runs fine!?
I'm going in circles here but can't figure out what's going on...

I have a development site running locally (where I created the child theme) Where I have no problems running the same plugins.

Could this be in the database? Is it a Ajax/ jquery issue?
I also noticed that the fly-out menus in the Dashboard stop working as well when GF is enabled...

Any help would be appreciated.

Post has attachment
Hi You all,

There is a brand new #Wordpress course on
"Create custom post types and taxonomies to extend the functionality of WordPress.

Happy Learning
Wait while more posts are being loaded