Episode #125 of the Stack Overflow podcast is here. We talk Tilde Club and mechanical keyboards. Listen now

Hot answers tagged

3

Since WordPress 5.1 (see #43187) it ships with the wp_targeted_link_rel() function, that adds noreferrer and noopener relation values to all anchor elements that have a target. This function is used to filter through the various input data just before saving it, e.g. post title, post content, post excerpt, comment content, term description, link ...


2

Your URL querystring is malformed. ? good before the first variable. & goes before any others. Your url should be http://mysite/login?user_id=6&category=3


2

The problem is in this part <?php if ( is_search() ) : // Only display Excerpts for Search ?> <div class="entry-summary"> <div class="entry"> <?php $content = get_the_content(); $content = strip_tags($content); echo '<p>' . substr($content, 0, 255) . ' [...] </p>'; ?> <hr class="post-divider"/> </div>...


2

To get the canonical (not ?page=1) reference URL to start the pagination from you have to change 'base' => '%_%' to 'base' => get_pagenum_link() . '%_%' // get_pagenum_link() default is '1' which will give you the first page of paginated posts and %_% will be replaced by 'format' parameter on the next pages.


1

Although not a question for this place (perhaps try over at StackOverflow https://stackoverflow.com/ ), you could try checking the referring page (although that can be spoofed) setting a cookie on WP and looking for it on the other site (although the 2nd site may not be able to read the first site's cookie). (added) Domain 2 cannot read a cookie that domain ...


1

Although this is not a WP question, it could be done with some PHP/MySQL code. Just the psuedocode: generate a GUID value on each main page visit check if the GUID is already in the GUID database if not, store the GUID in the GUID database if GUID exists in the database, redirect to another page ("you were already here, only one per customer" message) This ...


1

href="./contact-page" if you're on the homepage (/) this will become: /contact-page if you're on another page named foo (/foo/) this will become /foo/contact-page This is due to ./ being a relative path. To avoid struggles like this, the method via home_url() is preferred because it creates absolute links/paths that will work from anywhere you call it. ...


1

You can use get_category_link() for that: $allCat = get_the_category(); if( ! empty( $allCat ) ){ $lastCat = array_reverse( $allCat ); $last_cat_link = get_category_link( $lastCat[0] ); if( ! is_wp_error( $last_cat_link ) ){ echo '<a href="' . $last_cat_link . '">' . $lastCat[0]->name . '</a>'; } } https://developer....


1

The effect you are looking for can be achieved by adding the box-shadow to the link element directly. The span is totally unnecessary: Just change this: a { color: #545454; text-decoration: none; } a span:hover { color: #000000; box-shadow: inset 0 -10px #ffbe76; } a span{ box-shadow: inset 0 -10px #f6e58d; } To this: a { color: #545454; ...


1

you are my hero. I solved my issue with internal links with your code. I had to modify it because i got many different rel inside my code rel="nofollow nooopener" and rel="nooopener nofollow" so i modify with this: add_filter( 'the_content', 'ex1_the_content_filter' ); function ex1_the_content_filter($content) { // finds all links in your content with ...


1

The example code you've posted, as the documentation states, "Filters link URL of the header logo above login form" (emphasis mine). However, you are asking about changing the URL for the site logo (which I assume is somewhere in the header of every page). Normally this is done via the theme customizer. Depending on the theme, however, this feature may or ...


1

You could provide some more details, like what title attributes you are trying to remove. In the navigation, content, etc. Anyway, you could try adding this to your theme or child theme's functions.php file, I have yet to test it though. function remove_title_attributes($input) { return preg_replace('/\s*title\s*=\s*(["\']).*?\1/', '', $input); } ...


1

This annoying thing is introduced by Askimet. in wp_content/plugins/askmimet/_inc/askimet.js line 89 (askimet 4.1.2) insert a "return;" just after 86: // Show a preview image of the hovered URL. Applies to author URLs and URLs inside the comments. 87: $( '#the-comment-list' ).on( 'mouseover', mshotEnabledLinkSelector, function () { 88: clearTimeout( ...


1

Your best bet is a 'search and replace' plugin that will fix things in the database. I like the "Better Search and Replace" plugin. It has a 'test' mode so you can make sure that all is well. You would enter the first term in your question as the 'search', and the 2nd term as the 'replace'. Use the 'test' mode to make sure all is well. Of course, back up ...


1

Moving comment to answer: Did you try adding a delimiter around your regex pattern? That's what the little note on the bottom of your screenshot says. So for instance, /]>(.?)</a>/ , noting the added slashes. (Since this is replacing stuff in your database, let me say, use at your own risk.)


1

Use <?php the_permalink(); ?> to get the link to the current post. Essentially replace whatever the href property of the image link is right now so it looks similar to : <a class="post-thumbnail" href="<?php the_permalink(); ?>" >


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