6

When no hook is available, you can always count on the old jQuery trickery... add_action( 'admin_footer-edit-tags.php', 'wpse_56569_remove_cat_tag_description' ); function wpse_56569_remove_cat_tag_description(){ global $current_screen; switch ( $current_screen->id ) { case 'edit-category': // WE ARE AT /wp-admin/edit-...


6

Apply wpautop - it converts line breaks into <br /> and double breaks into paragraphs. echo wpautop( wptexturize( get_yoast_term_description() ) );


6

The short description template is /templates/single-product/short-description.php : <?php /** * Single product short description * * @author WooThemes * @package WooCommerce/Templates * @version 1.6.4 */ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly global $post; if ( ! $post->post_excerpt ) return; ?> <...


5

The filter views_{$this->screen->id} is fired just after the title of post edit screen has been print to screen, so it's a safe place to just echo what you want. So you can simply do: function post_type_desc( $views ){ $screen = get_current_screen(); $post_type = get_post_type_object($screen->post_type); if ($post_type->...


5

If we look at the source of wp_insert_attachment() we find the hooks edit_attachment and add_attachment. In your case we could use the add_attachment hook. The callback takes the attachment's ID as a parameter. By looking at the database table wp_posts we see that the description is saved as post_content and the caption as post_excerpt: Then you could try ...


5

The HTML is stripped by wp_filter_kses(). So this should work: remove_filter( 'pre_term_description', 'wp_filter_kses' ); When you want to print that content, use wpautop(): echo wpautop( term_description() );


4

Use CSS, I was implementing the JS solution and I didn't like the delay, then I've remembered about this. body.taxonomy-name .term-description-wrap { display:none; }


4

The meta description isn't part of the Twenty Fifteen theme. You mentioned the Yoast plugin in a previous question yesterday, so I guess the meta description comes from there. According to their API page, there's a filter called wpseo_metadesc that might be what you're looking for. Here's an untested example: /** * Change the Yoast meta description for ...


4

There's a wpseo_title filter you can hook into. Example: add_filter('wpseo_title', 'add_to_page_titles'); function add_to_page_titles($title) { $title .= $addToTitle; return $title; }


3

You can make use of wp_get_current_user() or get_currentuserinfo() (to which wp_get_current_user() is a wrapper function to) or get_current_user_id() which uses wp_get_current_user() to get the current logged in user ID. One way or the other, you need to make sure that you have a logged in user (user ID is not 0) before trying to get the user's metadata ...


3

There is not a standerized way to add HTML meta tags in WordPress but you can use wp_head action as a generic way to add meta tags. I think description meta tag should not be in the theme, as you suggest in your answer, because description meta tag is a property of the document, nothing to do with the look and feel of the document, that is, the theme. This ...


3

You need to get the metadata of each image, add this to your functions.php file: function get_post_gallery_images_with_info($postvar = NULL) { if(!isset($postvar)){ global $post; $postvar = $post;//if the param wasnt sent } $post_content = $postvar->post_content; preg_match('/\[gallery.*ids=.(.*).\]/', $post_content, $ids)...


3

OK, it took me a little while to debug this behaviour, but... Everything is clear for me right now... I'm not sure if this is fully intentional... Why is it so? So... The line breaks are stored in DB correctly. Then in wp_setup_nav_menu_item the description field is filled based on post_content column of given menu item post. On line 845 (https://core....


2

AFAIK, you can add new fields but you cannot remove the old ones! They are directly printed, and not stored in a variable to which a filter can be applied. Ref: wp-admin/edit-tags.php, line no. 380.


2

You can use pre_user_description hook, which filters the user's description prior to saving/updating the user, to remove any unwanted tags. To do that, you can use the wp_kses function, which strips out all but whitelisted tags. The allowed tags should be given as an associative array, where the keys are the names of the tags, and the values are an array ...


2

I was having the same problem the other day, due to a completely different typo ;) $args = array( 'description' =>"My Desc", 'slug' => "My Slug", 'parent' => 0 ); $result = wp_insert_term("Term1", "category", $args); Note the corrected 'description' element in the $args array.


2

There are two conditionals, depending on your setup: is_home() - checks if the main page is being displayed is_front_page() - returns TRUE when the main blog page is being displayed and the Settings->Reading->Front page displays is set to "Your latest posts", or when is set to "A static page" and the "Front Page" value is the current Page being ...


2

Ok I had to write my own custom excerpt like such: function custom_excerpt($text = '') { $raw_excerpt = $text; if ( '' == $text ) { $text = get_the_content(''); // $text = strip_shortcodes( $text ); $text = do_shortcode( $text ); $text = apply_filters('the_content', $text); $text = str_replace(']]>',...


2

I don't understand your attempt to use PHP_Exec, especially by embedding it in the content section of the page. That is going to run much too late to alter anything in the <head> of the document. Here is the problem you are facing, starting from what looks to be your primary question: So what I need to do is understanding how Wordpress is adding ...


2

Image data is stored as if it were a post, or a CPT, so you can treat it like one. $album_id = get_the_id(); $img = new WP_Query(array('p'=>$album_id,'post_type'=>'attachment')); var_dump($img->posts[0]->post_content); Or, a little more complicated,... $album_id = get_the_id(); $img = new WP_Query(array('p'=>$album_id,'post_type'=>'...


2

You are attempting to update your category's name to one that already exists. Duplicates are not allowed - either of other categories or of tags.


2

The "Reading Settings" at a domain's wp-admin/options-reading.php is, by default, set to latest posts. So, WordPress, by default, would show the title of the post being set at "General Settings" at a domain's wp-admin/options-general.php . In this case, Yoast's WordPress SEO plugin would have form fields to customize it. When the "Reading Settings" are ...


2

WordPress stores image (attachment) data as follows: Description: post_content field Caption: post_excerpt field Alt: _wp_attachment_image_alt meta value And in code, that translates to: // Description echo $post->post_content; // Raw the_content(); // Caption (description as fallback) the_excerpt(); // Caption (explicitly) echo $post->...


2

Using DOMDocument and DOMXPath you could try this. <?php while (have_posts()) : the_post(); ob_start(); // run the_content() through the Output Buffer the_content(); $html = ob_get_clean(); // Store the formatted HTML $content = new DomDocument(); // Create a new DOMDocument Object to work with our HTML $content->loadHTML( $html ); // Load the $html ...


2

The more proper API way would be using term_description() template tag. It's same in principle as accessing property, but with proper filters and stuff. Since term lists are usually focused on names, I can't anything that would iterate and list descriptions in one step.


2

The caption for an image is actually meta_data attached to the image and the get_post_gallery_images only returns a url, so in the array you won't have any other information. You could try something like: <?php $gallery = get_post_gallery_images( $post ); foreach( $gallery as $image_url ) : //get the id of the image post. $...


2

Where does Yoast SEO plugin sets the site/page title? Yoast SEO plugin adds two hooks that filter the title. add_filter( 'pre_get_document_title', array( $this, 'title' ), 15 ); add_filter( 'wp_title', array( $this, 'title' ), 15, 3 ); The pre_get_document_title hook was added in WordPress 4.4, so on older versions, that hook will never get fired. For ...


2

It will be interesting to see how the new evolving WP Gutenberg editor will handle shortcodes and embeds. If you use the [embed] shortcode for embedding, then a semi workaround, without UI support: [embed src="https://www.youtube.com/watch?v=jfNOdsvMke4" desc="some description"] where the custom desc attribute is supported with with this kind of wrapper: ...


2

bloginfo('description') just displays the site tagline. ‘description‘ – Displays the “Tagline” set in Settings > General. This data is retrieved from the “blogdescription” record in the wp_options table. https://developer.wordpress.org/reference/functions/bloginfo/#description So yes, it will be the same on every page. WordPress does not add meta ...


2

To avoid an infinite loop on transition_post_status hook when using wp_update_post(), try: add_action('transition_post_status', 'new_product_add', 10, 3); function new_product_add($new_status, $old_status, $post) { if( $old_status != 'publish' && $new_status == 'pending' && !empty($post->ID) &&...


Only top voted, non community-wiki answers of a minimum length are eligible