Save selected item from dropdown menu in a meta box as a metadata value for a custom post type

$myterms = get_terms($taxonomies, $args); returns an array of term objects. Use $term->term_id as option value … “<option value=”$term->term_id”>”. esc_html( $term_name ) . “</option>” … and store that ID, not the name. Names can change, the IDs will stay the same – unless someone deletes a term and creates a new one with the same name. … Read more

Including file or library from other plugin

In your plugin add a custom action to let other plugins start after your basic code has done the work: // load basic classes do_action( ‘my_library_loaded’, plugin_dir_path( __FILE__ ) ); Other plugins can start their work now like this: add_action( ‘my_library_loaded’, ‘other_plugin_init_handler’ ); They will never do anything if your base plugin is not active. … Read more

Pages 404 in wordpress

Like Manish, I think the issue is with AllowOverride. The following is based on a Debian server. Ubuntu, if you are not aware, is based on Debian. In your apache2/ directory, you should have a sites-available/ and a sites-enabled/ directory. Disable your site with a2dissite Edit the appropriate file in sites-available/ to include the AllowOverride … Read more

Understanding apply_filters

Well, apply_filter creates a global filter hook which can be used dynamically all over the system. Which gives you the ability to filter the content of the $instance[‘title’], means you can over ride the content as well as can modify the content. Here is the example- add_filter( ‘widget_title’, ‘widget_title_to_uppercase’, 10, 1); function widget_title_to_uppercase( $content ){ … Read more