Run filter if only it was run from specific admin page ( ‘upload_dir’ changed )

Adding filter: add_filter( ‘upload_dir’, ‘change_upload_dir’, 10, 1 ); Function content: function change_upload_dir($param) { // Check for REFER $actual_page = $_SERVER[‘HTTP_REFERER’]; parse_str( parse_url($actual_page, PHP_URL_QUERY), $query_array ); if ( strpos($actual_page, ‘plugin_name.php’) ) { $mydir=”/customdir”; $param[‘path’] = $param[‘basedir’] . $mydir; } return $param; } Hope this will help Other ideas, based not on HTTP_REFERER, are appreciated 🙂

Improving this link color picker code

Create customizer.js file and put the following script in the customizer.js file (function( $ ) { “use strict”; wp.customize( ‘tcx_link_color’, function( value ) { value.bind( function( to ) { $( ‘a’ ).css( ‘color’, to ); } ); }); })( jQuery ); And enqueue your customizer.js file by using wp_enqueue_script in your customizer.php file like this … Read more

My code for creating an admin option doesn’t work

Make Sure Your Functions, Slug and Callback Functions are Unique(Means Different from any other plugin or default WordPress). Also to save options use Settings API http://codex.wordpress.org/Function_Reference/register_setting <?php add_action(‘admin_menu’, ‘add_unique_custom_options’); function add_unique_custom_options() { add_options_page(‘Global Custom Options’, ‘Global Custom Options’, ‘manage_options’, ‘unique-functions’,’unique_custom_options’); } function unique_custom_options() { ?> <div class=”wrap”> <h2>Global Custom Options</h2> <form method=”post” action=”options.php”> <?php wp_nonce_field(‘update-options’) … Read more

Disabling “View” mentions from backend?

Instead of disabling it, you’d be better off by hiding it using a bit of CSS trickery. Try this and let me know if it works: add_action(‘admin_head’, ‘hide_quick_view’); function hide_quick_view() { echo ‘<style> span.view {display: none !important; visibility: hidden !important; opacity: 0 !important;} </style>’; } This should be placed in your functions.php file.