- B-E-A-Utiful
- Hungover
- You've been blacklisted.
- So cool.
- It does exist.

This gallery contains 53 photos.
I should be standing at the podium right now. Not sure this session will be recorded, but you can definitely check out my web presentation here, and follow along on Twitter
.
Well, not quite that long. I was in Florida this past December, but it was for work and I was in Ocala. Plus it was also about 40° out.
Any way, I’ll be back in Florida in one week from tomorrow! In Miami to boot. I’ll be heading there for WordCamp and I will also be presenting. If you’re interested in creating widgets with the new WordPress widget API you might want to come check me out!
I’ve actually been asked this a few times, and have seen others do it a few different ways. Anyway, here is my method:
/* Flush rewrite rules for custom post types. */
add_action( 'load-themes.php', 'frosty_flush_rewrite_rules' );
/* Flush your rewrite rules */
function frosty_flush_rewrite_rules() {
global $pagenow, $wp_rewrite;
if ( 'themes.php' == $pagenow && isset( $_GET['activated'] ) )
$wp_rewrite->flush_rules();
}
Obviously, if you’re using this in a plugin you’d change See comments below.themes.php to plugins.php and load-themes.php to load-plugins.php.
Enjoy.
I’m building an auto-theme updater for self hosted (non repository) based WordPress themes. I’ve built most of my code off Clark’s PHP script.
I’ve made major modification and would love to share them once I’m 100% done, but first…
I’m stuck on this final part with will allow for multiple themes and/or plugins to access one API file. In my update script (inside my theme) I’m sending this:
$prefix = 'theme-name'; $request = array( 'slug' => $prefix ); $url = 'http://url-of-my-api.key/index.php'; $options = array( 'body' => array( 'request' => $prefix, // OR //'request' => serialize( $request ), 'version' => $theme['Version'], 'wp_version' => $wp_version, 'php_version' => phpversion(), 'user-agent' => "WordPress/$wp_version;" . get_bloginfo( 'url' ) ) ); $response = wp_remote_post( $url, $options ); $update = wp_remote_retrieve_body( $response );
And in my index.php file located at my API site, I am trying to get the body’s request (which is my theme name). I’ve used $_POST['request'] and $_REQUEST['request'] with no results, any ideas?
Also, sidebar… Trying to deny public access to this file, but I added a preg_match() for PHP_SELF on the index.php file but it was triggered by the wp_remote_retrieve_body. Booo. Know of a better way than show below?
if ( preg_match( "/index.php$/i", $_SERVER['PHP_SELF'] ) ) {
header( 'Status: 403 Forbidden' );
header( 'HTTP/1.1 403 Forbidden' );
die( "You don't have permission to access this file directly." );
}
I am stuck on this one and would be grateful if someone pointed out what I am missing.
Here is my situation: I’ve got a custom taxonomy called venues and I’ve added custom meta to that taxonomy via a custom table called $wpdb->venuesmeta which looks like this:
| meta_id | venues_id | meta_key | meta_value |
|---|---|---|---|
| 1 | 4 | address | 9009 W Sunset Blvd |
| 20 | 15 | address | 1401 Santa Monica Blvd |
Just a quick two cell example (there is more in there).
Ok. So in certain circumstances, or rather most of the time I am querying the table if only pulls the first cell which happens to be 4.
I created this function which fixed the problem most of the time:
function get_venues_id_by_key( $meta_key ) {
global $wpdb;
$venue = $wpdb->get_var( $wpdb->prepare( "SELECT venues_id FROM $wpdb->venuesmeta WHERE meta_key = %s", $meta_key ) );
if ( $venue != '' ) {
$venue_id = (int)$venue;
return $venue_id;
}
return false;
}
Where I am using it like $address = get_metadata( 'venues', get_venues_id_by_key( 'address' ), 'address', true );.
But in the front end when on a taxonomy in venues like /venues/$tax_name/. It’s still querying the first cell and not the current ID.
So I thought I need to compare the venuesmeta table to the term_taxonomy and can’t seem to get that code working proper. The term_taxonomy table would be:
| term_taxonomy_id | term_id | taxonomy | description | parent | count |
|---|---|---|---|---|---|
| 3 | 3 | venues | 0 | 1 | |
| 4 | 4 | venues | 0 | 3 |
Just a quick two cell example of the term_taxonomy (there is more in there).
So in order to to pull in the $tax for ID of 3, I thought to do a compare of the above function to the term_taxonomy table, but only got to this function, guess this is where i need help..
function get_venues_id_by_key_match( $meta_key ) {
global $wpdb;
$venue = $wpdb->get_var( $wpdb->prepare( "SELECT venues_id FROM $wpdb->venuesmeta WHERE meta_key = %s AND term_id FROM $wpdb->term_taxonomy WHERE taxonomy = venues", $meta_key ) );
if ( $venue != '' ) {
$venue_id = (int)$venue;
return $venue_id;
}
return false;
}
This gallery contains 77 photos.