post_id always wrong in plugin

You can’t use get_the_ID() when you are not in the loop (eg. in nav menus). Fortunately, the the_title filter comes with the post ID in an extra argument. Change your code to this, to make it work in all places: function mealingua_title_filter($title, $post_id) { #some stuff if (is_front_page() OR is_single() OR is_page()) { return ‘<span … Read more

Hook for image edit popup

The answer is there is no damn hook for the edit button. It’s just a bunch of JS contained within wp-includes/js/tinymce/plugins/wpeditimage/plugin.js. I’ve included the barebones of what you need below. Key points: a. Clicking an element with a data-wp-imgselect attribute will open the image edit dialogue. You need to change that to something else if … Read more

How to make WordPress use protocol indepentent upload files?

You can define a function to remove the protocol and hook it to the attachment URL: function wpse_79958_remove_protocol_from_attachment($url) { $url = str_replace(array(‘http:’, ‘https:’), ”, $url); return $url; } add_filter( ‘attachment_link’, ‘wpse_79958_remove_protocol_from_attachment’ ); Also consider to use relative URLs for attachments by using WordPress builtin function wp_make_link_relative: add_filter( ‘attachment_link’, ‘wp_make_link_relative’ ); Place this code to your … Read more

Using Vagrant for customizable WordPress Multi-sites [closed]

You can try using the Genesis-Wordpress(Note: not the framework) project for this. It does more or less what you have described above including, Provisioning (with Ansible) Deployment (with Capistrano) Database Synchronization (with custom Capistrano tasks) It also uses the Vagrant Host Manager to workaround the /etc/hosts issue. So the site is served over port 80. … Read more

Making plugin unique to not conflict with plugins with the same name

Do you need the “View Details” link? It shouldn’t show up unless it’s a WP hosted plugin. Could you just name the plugin whatever you want, but change it with JS in the admin function my_enqueue($hook) { if ( ‘plugins.php’ != $hook ) { return; } wp_enqueue_script( ‘my_custom_script’, plugin_dir_url( __FILE__ ) . ‘changeName.js’, array( ‘jquery’ … Read more