Tag Info

New answers tagged

1

Here's a slightly modified version of your code snippet: add_action( 'login_head', [ 'WPSE_Admin', 'plugin_setup' ] ); class WPSE_Admin { public static function plugin_setup() { add_filter( 'login_headerurl', [ 'WPSE_Admin', 'the_logo_url' ] ); } public function the_logo_url() { return get_bloginfo('url'); } } The ...


0

I think you are encountering a bug in _wp_translate_postdata() that makes it check edit_others_posts without providing any context for map_meta_cap and other filters to use in situations like yours (where you want a user to be able to edit specific posts that aren't theirs): https://core.trac.wordpress.org/ticket/30452#comment:5 It specifically has the ...


0

I believe the 'strange' character is one that exists outside of the standard character set. Some browsers and text editors will display this as a small square or rectangle, some may display a small dot, some may not display it at all. It could have crept in through a copy and paste, but that's just a guess. If commenting the tag out and adding a fresh one ...


0

I managed to fix this issue by commenting out the first body tag and placing a second body tag below like this: <!-- <body> --> <body <?php body_class( $class ); ?>> Now the site is working correctly. However the strange character is still appearing in the first body tag. Hope this helps someone.


0

Unsure of WP version compatibility, but taken from the Soil plugin module clean-up.php for Roots. Use in your theme's functions.php or similar. function clean_script_tag($input) { $input = str_replace("type='text/javascript' ", '', $input); return str_replace("'", '"', $input); } add_filter('script_loader_tag', 'clean_script_tag');


0

A prettier solution would be to disable the capability of creating a custom_post_type: Simply pass the the parameter 'create_posts' => false, in the capabilities array when calling register_post_type. $args = array( 'label' => __( 'Custom Post Type', 'text_domain' ), 'description' => __( 'Custom Post Type', ...


0

The comment form is generated from another domain via the iframe. While I was accessing the iframe using jQuery content() it returned me Permission denied to access. It means the Jetpack is Cross Site Scripting protected and you cannot edit the placeholder.


0

At the end of your function return the output as described in the documentation. return ob_get_clean(); Add the [myshorcode] shortcode to a text widget. By default, widgets are not rendered in text widgets so make sure you add this snippet to your plugin: add_filter('widget_text', 'do_shortcode');


2

Better solution if you want to disable this: use a plugin. Same code as from Christine's comments: https://wordpress.org/plugins/disable-emojis/ Same code that also fixes the smilies to be the older ones: https://wordpress.org/plugins/classic-smilies/ Source: Me, since I wrote that code in the first place. ...


12

We will hook into init and remove actions as followed: function disable_wp_emojicons() { // all actions related to emojis remove_action( 'admin_print_styles', 'print_emoji_styles' ); remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); remove_action( ...


0

Thanks for raising this issue, it interests me as well. After searching everywhere for an acceptable solution, this is how I approach the problem on my site, at least for now: comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => '25' ))) If you change '25' to, say, '1000', this will give you pretty much 'infinite replies', ...


1

You are almost close. add_filter( 'some_custom_filter', array( $this, 'filter_suppress_the_content' ), 10, 3 ); // the above line states that, the method `filter_suppress_the_content` should have three arguments, where you have used nothing. public function filter_suppress_the_content() { return true; } // comparing your code, this method should have ...


0

i think the best way to alter images is through css. you add a class to all your pictures that would set its size into your custom size. I think bootstrap has that feature


4

You can use the category__in argument: // use get_the_category( $post_id ) if you are outside the loop $categories = get_the_category(); if( $categories ){ $related_posts = get_posts( array( 'category__in' => $categories ) ); }


0

Here is example: add_action('pre_get_posts','search_filterr');function search_filterr($query) { if ( !is_admin() && $query->is_main_query() ) { if ( $query->is_search ) { $query->set('post_type', array('post','custom-posttt-too') ); $query->set('category__in', 999 ); <------ ...


0

I figured it out. It looks as if the Codex never referenced the one parameter I needed to make it work in the Codex. I checked out this site here for a full list of parameters in the arrays http://www.billerickson.net/code/wp_query-arguments/ I needed to use post_parent and not child_of or parent. Fixed.


0

Just use the $product parameter to get the custom field value, and determine what to return: function custom_price_html( $price, $product ) { if ( ( int ) get_post_meta( $product->id, 'price_per_person', true ) ) $price .= ' per person'; elseif ( ( int ) get_post_meta( $product->id, 'price_per_group', true ) ) $price .= ' per ...


0

The recommended best practice is to use a mu-plugin for this. Adding add_filter()s to wp-config.php directly can cause all kinds of other problems and conflicts.


0

The author key/value query won't work. Try modifying the query by moving the query out of the meta query like so: array( 'author' => $author, 'meta_query' => array( 'relation' => 'OR', array( 'key' => 'leads_status', 'value' => '-1', ), array( 'key' => ...


0

It's actually used by WP to allow plugin developers change WP behavior. You can make your code flexible using do_action so other plugin/theme developers or simply yourself can change behavior of your code. For example imagine you have a WP loop in a theme framework. You would like to add breadcrumb at the top of it, here is the simplest method: ... ...


0

Your plugin code is going to run before the theme code and hence will run before anything is added to the hook. You will need to the code that processes the file inclusion to some other hook that runs after all of the plugins load, like after_setup_theme This should help: Is there a flowchart for wordpress loading sequence?



Top 50 recent answers are included