save_post not working with attachments

Not really, attachments are still not “full post types”. Manny Flerumond hints this quite well in this thread: Was thinking about this the past few days: currently any media files uploaded to a WordPress site defaults to the post status of inherit, which is a holdover to when media attachments were just that. Media was … Read more

Hook to generate a dynamic sitemap with “All in One SEO Pack” Plugin

This is the solution from Peter Baylies (Plugin Author) add_filter( ‘option_aioseop_options’, ‘itdge_sitemap_addl_pages’ ); function itdge_sitemap_addl_pages( $option ) { if ( !empty( $option ) && !empty( $option[‘modules’] ) && !empty( $option[‘modules’][‘aiosp_sitemap_options’]) ) { $my_sitemap_entries = Array( ‘/test1’ => Array( ‘prio’ => ‘0.1’, ‘freq’ => ‘daily’, ‘mod’ => ‘2014-04-01’ ), ‘/test2’ => Array( ‘prio’ => ‘0.3’, ‘freq’ … Read more

Hook after wp_enqueue_scripts

You can hook into wp_enqueue_scripts very late, using the priority argument of add_action. For example: function hook_really_late() { echo ‘Should reasonably be last’; } add_action(‘wp_enqueue_scripts’,’hook_really_late’,PHP_INT_MAX); PHP_INT_MAX should be the highest number assignable as a priority. It is possible that some other code uses the same trick though. That is still probably what I’d recommend. If … Read more

get_plugins() doesn’t work after plugins_loaded

Possibly you’re trying to use that code in a non-admin page. The functon get_plugins is only available on admin side and if you ant to use it somewhere else you have to load the file “plugin.php” manually. To solve this error add that check at the beginning of your function: if ( ! function_exists( ‘get_plugins’ … Read more