Tag Info

Hot answers tagged

5

You can hook onto pre_insert_term, check the taxonomy and whether or not the user has the specified role as follows: function disallow_insert_term($term, $taxonomy) { $user = wp_get_current_user(); if ( $taxonomy === 'post_tag' && in_array('somerole', $user->roles) ) { return new WP_Error( 'disallow_insert_term', ...


3

This is an older question, but here's the answer for future generations: WordPress will check the styles against a whitelist and it will still strip the style attribute if none of the styles are safe. The default whitelist is: text-align margin color float border background background-color border-bottom border-bottom-color border-bottom-style ...


2

Another very simple solution is to put this in your css file : .tagcloud a:before { content: "#"; font-color: #000; }


2

Firstly, I would consider using one of WordPress' wp_kses-like functions, instead of PHP's strip_tags(). Secondly, query your posts with WP_Query or get_posts() with the fields parameter set to ids - seems like you don't need more than that. Thirdly, split up your loop into steps that are effective and manageable. Because 34000+ posts will likely reach the ...


1

The quickest solution is export posts table from database, replace tags this using any code-editor. For posts content are simple text not serialized, in this way you can do all replacement in less than 10 minutes without any hassle. Then import the sql file in db. Thanks


1

The easiest way to do this would be via SQL. Firstly take a backup of your database in case anything goes wrong. Then using phpMyAdmin or a similar SQL frontend run this SQL command: UPDATE wp_posts SET post_content = REPLACE(post_content, '<br>', ''); This will replace the tag <br> with nothing in all post content. If the tags are in ...


1

Use orderby=id You can simply sort the tags by term_id with the following GET request: /wp-admin/edit-tags.php?taxonomy=post_tag&orderby=id&order=desc and similar for other taxonomies. Why does this work? The orderby parameter is read through: if ( !empty( $_REQUEST['orderby'] ) ) $args['orderby'] = trim( wp_unslash( $_REQUEST['orderby'] ) ...


1

Did you try without $query-> in front of get_template_part() ?


1

You're right. It isn't a good structure. You are running three queries on the page-- the two you are creating plus the main query that is being completely ignored (plus ancillary queries). You are also clobbering the main query halfway through the page load when you overwrite $wp_query, which can cause unexpected and unpredictable results and difficulty ...


1

I don't suspect that your tax_query is failing you, but actually your tag parameter is. single_tag_title() returns the name of the tag, not the slug. All tag and category queries are converted to a tax_query in the WP_Query class before being passed to the WP_Tax_Query class to build the relative string for the SQL query. Term names and slugs gets ...


1

This is being caused by core bug #33106 which was unfortunately introduced with the security fixes in 4.1.6 (and 4.2.3). New lines are erroneously being stripped from CDATA blocks in this situation. From the bug ticket: As of 4.2.3, depending on how a CDATA block is used, the stripping of new lines in this content may break when displayed on the front ...


1

For non-hierarchical terms (such as tags), you can pass either the term name or id. If you pass the id there is only one caveat: You must pass it as an integer, and it must be in an array. This is necessary because any non-array value passed will be converted to a string, which will be interpreted as a term name. $tag = '5'; // Wrong. This will add the tag ...



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