Overriding Attributes values in Shortcode Plugins

Try not to use capital letters in the shortcode attributes, use for example [wi_form product_name=”php” product_price=”888″ ] where: add_shortcode( ‘wi_form’ , ‘wi_form_func’ ); function wi_form_func($input) { extract(shortcode_atts( array( ‘product_name’ => ‘Java’, ‘product_price’ => 1000 ), $input)); return $product_name . esc_attr( $product_price ); } or this: add_shortcode( ‘wi_form’ , ‘wi_form_func’ ); function wi_form_func($input) { $input = … Read more

like to keep reading plugin

There are three major flaws with what you’re asking: 1. You are attempting to use a WordPress API in a file loaded separately from WordPress. This will only work if you include WP in that file (resulting in the performance difference you likely expected to gain by loading a static file vs. a page/post being … Read more

plugins_url function mixes system path and URL

Short Answer jquery-ui.widget is one of standard scripts already included and registered in WP. You don’t need to register it, just enqueue. In your code what is wrong is the dirname function inside plugin_url. Leave only __FILE__ as second argument of plugins_url Long Answer: More Info jquery-ui.widget is one of standard wordpress scripts so, in … Read more

remove_action in plugin file

Make sure you remove the action after the theme has added it. And use the same priority. A rather safe way is using the same action you want to clean up: add_action( ‘admin_notices’, ‘remove_woothemes_updater_notice’, 0 ); function remove_woothemes_updater_notice() { remove_action( ‘admin_notices’, ‘woothemes_updater_notice’ ); }

Reset WordPress website

One way to solve this would be to set up your demo site exactly how you want it to reset every day (use a standard username and pass like “admin” and “testpass”), and then dump the database and zip the files. Then, put the zip somewhere on your server. Set up a BASH script that … Read more

WordPress is giving errors after activating WP_DEBUG

Firstly, fixing those is not essential, but it would pay to keep them in mind. For your live site WP_DEBUG should be false (development sites should have this on so that as you write the code you are warned of these things). 1) This is probably just a matter of removing the & in the … Read more

building plugin and it is displaying above plugins page

You’re using add_menu_page wrong. The function bittech_login_settings should be only: function bittech_login_settings() { add_menu_page( ‘BitTech Login Settings’, ‘BitTech Login Settings’, ‘add_users’, ‘bittech_settings’, ‘bittech_login_settings_callback’ ); } function bittech_login_settings_callback() { // content of the menu } And put the contents of the page in the callback function bittech_login_settings_callback. Also, these lines don’t make much sense: $filename = … Read more

Possible to add a language file to a plugin without adding .po/.mo files to plugin directory?

Best way to do this is probably by using a second, custom-made, plugin. Make a new plugin directory. Call it something like “example-com-custom-langs” or something unique to your site. In there, make a php file with a plugin header describing what the plugin does (for your own sanity), and do something like this: add_action(‘plugins_loaded’,’example_com_custom_langs_plugins_loaded’); function … Read more

Conditionally bypass plugin

The list of active plugins is provided by wp_get_active_and_valid_plugins() during core load and comes from active_plugins option (multisite details aside). While there is no explicit filter for it as any option it can be filtered via ‘option_’ . $option hook (so option_active_plugins) and mu-plugin (which are being loaded earlier) should be able to do it. … Read more