Hot answers tagged

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

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

It seems from your example that the key parts of the URL structure are staying the same. 2016/5/document.pdf That means you could use a plugin like 'Better Search Replace' (https://en-gb.wordpress.org/plugins/better-search-replace/). Simply choose to replace: www.example.com/files/ with www.example.com/wp-content/uploads/sites/#/


2

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

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

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

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

Updated 2018: Latest Version of Wordpress Heirarchy


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(); ?>" >


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

I thought regex search may become critical so html dom parser may help. See the code below (if it helps): <?php $post_content = get_the_content(); $dom = new DomDocument(); $dom->loadHTML($post_content); foreach ($dom->getElementsByTagName('a') as $item) { echo "<a href=".$item->getAttribute('href')." target='_blank' rel='". $item->...


1

I don't know the scale of your project, my solution will help you to get around it quickly, but it's inefficient when it comes to larger scaled projects. The easy way You can add a filter to the_content filter and finally link every word inside of the content to the search page of that specified word. The Hard Way This is way much better than the first ...


1

You can search and replace every occurence of "http://example.com/subdir" in the database with "http://example.com". If you're comfortable with WP-CLI, there is command for that: $ wp search-replace 'http://example.com/subdir' 'http://example.com' If not, you can use some plugin for that. Some possible would be: WP Migrate DB Better Search Replace


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