Escaping quotes from shortcode attributes
It seems you are working on the wrong end. Try sanitizing the user input, for instance by means of sanitize_text_field, not the shortcode output.
It seems you are working on the wrong end. Try sanitizing the user input, for instance by means of sanitize_text_field, not the shortcode output.
Surely this approach has some benefits, but has also some issues. It’s not really easy to use If the target of your plugin are WordPress developers, they will be very familiar with plugin API, but end users are not. For a non-developer, something like: $data = give_me_the_data(); It’s easier to understand, remember and type than: … Read more
You should pass the special wp_rest nonce as part of the request. Without it, the global $current_user object will not be available in your REST class. You can pass this from several ways, from $_GET to $_POST to headers. The action nonce is optional. If you add it, you can’t use the REST endpoint from … Read more
The Widgets API is the quickest way to make a widget that’s reusable. Example use: class My_Widget extends WP_Widget { /** * PHP4 constructor */ function My_Widget() { My_Widget::__construct(); } /** * PHP5 constructor */ function __construct() { // actual widget processes } /** * Echo the settings update form * * @param array $instance … Read more
I want to change the default HTML code structure so that I can insert additional tags Run a filter on img_caption_shortcode, you can find that hook in the source here. http://core.trac.wordpress.org/browser/tags/3.0.1/wp-includes/media.php#L720 Example add_filter( ‘img_caption_shortcode’, ‘my_caption_html’, 10, 3 ); function my_caption_html( $current_html, $attr, $content ) { extract(shortcode_atts(array( ‘id’ => ”, ‘align’ => ‘alignnone’, ‘width’ => ”, … Read more
The “Log In” string is passed to the translation function, and you can filter that. To prevent needing to filter every little string, you can activate this filter right before the login form is printed. add_action( ‘login_form’, ‘wpse17709_login_form’ ); function wpse17709_login_form() { add_filter( ‘gettext’, ‘wpse17709_gettext’, 10, 2 ); } function wpse17709_gettext( $translation, $text ) { … Read more
Try this code in your custom plugin which is better to activate for the network. if ( !is_super_admin() ) { remove_all_actions(‘admin_notices’); }
While I appreciate the idea, isn’t this just replacing one plugin with another? Rarst’s link already has the answer — it just needs to be reworked a bit to check for the plugin periodically, like so: function goodbye_dolly() { if (file_exists(WP_PLUGIN_DIR.’/hello.php’)) { require_once(ABSPATH.’wp-admin/includes/plugin.php’); require_once(ABSPATH.’wp-admin/includes/file.php’); delete_plugins(array(‘hello.php’)); } } add_action(‘admin_init’,’goodbye_dolly’); Slap that into your functions.php file (in … Read more
Try the following: <?php $fname = get_the_author_meta(‘first_name’); $lname = get_the_author_meta(‘last_name’); $full_name=””; if( empty($fname)){ $full_name = $lname; } elseif( empty( $lname )){ $full_name = $fname; } else { //both first name and last name are present $full_name = “{$fname} {$lname}”; } echo $full_name; ?>
That information is stored in the MySQL database, not in files like you may be thinking of. They aren’t stored in .php or .html files. If you want to “see” how and where that data is stored the easiest way is to browse the database using a tool like PhpMyAdmin. NOTE: Technically, there are files … Read more