New answers tagged

1

Give something like this a try: (it came from the same page you linked to, just scroll down a bit more). $args = array( 'post_type' => 'post', 'tax_query' => array( 'relation' => 'AND', // searches for posts meeting both conditions array( 'taxonomy' => 'midgets', 'field' => 'slug', 'terms' => array( ...


1

It's outputting the word Array which is self explanatory. Instead of direct echoing it, you will need to turn the array into a string. Try implode, something like: Tags: <?php $my_theme = wp_get_theme(); echo implode(', ', $my_theme->get( 'Tags' ) ); ?>


0

You can add this below code in your function.php file function content_formatter($content){ $new_content = ''; $pattern_full = '{(\[raw\].*?\[/raw\])}is'; $pattern_contents = '{\[raw\](.*?)\[/raw\]}is'; $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE); foreach ($pieces as $piece) { if ...


-1

Sorting works fine except you will lose the capability to delete multiple Tags or any other than the last one.


4

That's because the main query is being discarded and replaced with your custom query. You've not told your custom query to look for that tag, so why would it? You might also notice your pagination is broken for the same reason, you've not told the new query which page you're on, so why would it pull the right page? What's more, that main query is expensive! ...


2

Basically, when you add a new term, WordPress will use term_exists() to validate term before add it to database. term_exists() uses sanitize_title() which uses remove_accents() and sanitize_title_with_dashes() to sanitize term. remove_accents() will converts all accent characters to ASCII characters and sanitize_title_with_dashes() will limits the output ...


1

After join term_id exist two times. You should specify which term_id you are querying by prefixing full table name (or alias). Also there is a other error term_taxonomy.term_id = terms.term_id missing table prefix. So the updated query will look like $query = 'SELECT term_taxonomy_id, ' . $wpdb->prefix . 'terms.term_id, taxonomy, name FROM ' . ...


0

1) It's tag__in (two underscores) 2) get_the_tags() returns an array of objects, you need IDs: if ( $the_tags = get_the_tags() ) { // https://developer.wordpress.org/reference/functions/wp_list_pluck/ $the_tags = wp_list_pluck( $the_tags, 'term_id' ); } $rel_pst = get_posts( array( 'tag__in' => $the_tags, 'exclude' ...


1

Whithout knowing the value of $tags variable (you are not showing it to us), the only thing I see wrong in your code is the tag_in argumente, the correct one is tag__in (note the double _). Also, note that tag__in works with the core tag taxonomy. This taxonomy is not supported by custom post types by default, only by the standard post type.


2

On the top of my head there are two easy ways to go about this problem, first is to use the get_the_tags() function to manually loop the tags to easily insert the hashtags. $tags = get_the_tags(); if ( $tags ) { foreach ( $tags as $tag ) { ?> <a href="<?php echo get_tag_link( $tag->id ); ?>"> <?php echo '#' ...


0

To add to what @brasofilo answered 3 years ago, this is what is necessary in the current menu system (WP v4.5.1). add_action( 'admin_head-edit-tags.php', 'modify_menu_highlight_wpse_43839' ); function modify_menu_highlight_wpse_43839() { if( 'post_tag' == $_GET['taxonomy'] ) { ?> <script type="text/javascript"> ...



Top 50 recent answers are included