Hot answers tagged

22

You are almost there. The function you need is sanitize_title_with_dashes( $title )


12

There is no documentation on it but you could always apply a filter to the_title like this: add_filter('the_title','some_callback'); function some_callback($data){ global $post; // where $data would be string(#) "current title" // Example: // (you would want to change $post->ID to however you are getting the book order #, // but you ...


10

@nevster, The best permalink structure for seo is /%category%/%postname%/ This permalink structure gives you the most keywords loaded into the URL of your post. Since the category that you’ve placed your post under usually relates to the post title, you will have an extra SEO benefit if other websites use that permalink structure to link your post. EDIT ...


8

Try putting this snippet in your functions.php <?php function rel_next_prev(){ global $paged; if ( get_previous_posts_link() ) { ?> <link rel="prev" href="<?php echo get_pagenum_link( $paged - 1 ); ?>" /><?php } if ( get_next_posts_link() ) { ?> <link rel="next" href="<?php echo ...


7

take a look at WordPress SEO by Yoast it will cover : 1) make the title of the page, the title of the post 2) make the description based on the first paragraph as for your #3 make the keyword meta by parsing the whole post, retrieve all the relevant word that are more that 3% occurrence, and fill the meta with them I highly doubt you ...


6

You can remove some of the header stuff with the following. // remove unncessary header info function remove_header_info() { remove_action('wp_head', 'rsd_link'); remove_action('wp_head', 'wlwmanifest_link'); remove_action('wp_head', 'wp_generator'); remove_action('wp_head', 'start_post_rel_link'); remove_action('wp_head', ...


6

Hi @CJN:, Your first question, moving the WordPress directory is handled differently from the rest. Moving WordPress from Subdirectory to Root: Go into /wp-config.php and add the following to defines (using your client's domain instead of example.com of course): define('WP_SITEURL', 'http://example.com'); define('WP_HOME', WP_SITEURL); 301 ...


6

Decided to entertain the idea. Adapted from my snippet that changes anchors to collapsed domain names. Little too verbose, but seems to work. add_filter( 'the_content', 'anchors_to_page_titles' ); function anchors_to_page_titles( $content ) { preg_match_all( '/<a.*?href="(.*?)".*?>(.*?)<\/a>/', $content, $matches ); array_shift( ...


6

By default the plugins are ranked by "relevance" and the only people who know how that algorithm is weighted work for wordpress.org (it's doubtful they are going to let anyone in on it). Downloads and rating are not the main components, just one of many including keywords, date, and how many beers you buy Otto. You don't have any options to rank high ...


5

Your rule works with the attachment ID, so I'm not sure how you're using the title, but the answer is almost identical in either case. The filter you want is attachment_link: function wpd_attachment_link( $link, $post_id ){ $post = get_post( $post_id ); return home_url( '/images/' . $post->post_title ); } add_filter( 'attachment_link', ...


5

From the WordPress SEO FAQ: ... either enable "Force rewrite titles" on the SEO -> Titles settings page, or go into your header.php and change the title element to just this: <title><?php wp_title(''); ?></title> Did you try that?


5

You'll find this post by Joost De Valk on changing WordPress permalinks to only include /%postname% very helpful. How many posts you have doesn't matter anymore if you are using the latest version of WordPress (at least > v3.3.1). I believe your permalink structure initially was — this /blog/%year%/%monthnum%/%day%/%postname%/ — and now, you are planning ...


5

Any reasons you couldn't put an anchor link to the actual page in your tab control? Then use jQuery to make sure it returns false and doesn't "work" for normal visitors. In fact, that's what the jQuery Tabs control page suggests: Tabs supports loading tab content via Ajax in an unobtrusive manner. The HTML you need is slightly different from the one that ...


4

ASCII characters will not cause any issues with search engines and they will be displayed properly. SEOmoz does this to avoid any chance of sql injection via its form fields.


4

It looks like this is now a standard feature on Wordpress.com. http://en.support.wordpress.com/offsite-redirect/


4

This should be possible. First, you're lucky that www.mytravelblog.com/jakarta/myPostName/ already works, it shows you the post and doesn't redirect you to the longer version (at least it seems to work on my side). That means you only have to work on the generated link, and not mess with the way incoming URLs are handled or "canonicalized". The result of ...


4

Hi *@Bobby Jack:* You'll have absolutely zero problem given your number of pages and posts. If you were looking at 5000, 10k, 25k pages or more, then start to worry. And the real problem is with categories as the URL base in the current implementation of WordPress' URL routing (which I hope to see changed in v3.2 or v3.3): Category in Permalinks ...


4

Ideally, SEO should always be handled by the theme. Actually, most plug-in behavior that impacts the front-end of a site should be handled by the theme. Plug-ins like All in One SEO are quick solutions for people who don't want to invest the time required to re-code a theme they built, downloaded from a free site, or purchased from another developer. ...


4

Here's an answer from a slightly different perspective. Personally, I would love it if the theme handled all of the SEO issues itself, instead of an external plugin. But whenever I build a custom theme for a client, I include the All in One SEO plugin even though my theme is already packed with SEO goodness. The reason is because my clients aren't always ...


4

WordPress select template, following its Template Hierarchy logic. What you have that is category archive, templates for individual pages are never considered for it. Also.. with the view of SEO, page.php is more important then category.php.. right? PHP template file is entirely back-end concepts, it doesn't have anything to do with SEO inherently.


4

Check your theme (header.php). If it uses something like this : <title><?php wp_title( '|', true, 'right' ); ?></title> You can use this filter : add_filter( 'wp_title', 'wpse104667_wp_title' ); function wpse104667_wp_title( $title ) { global $post; if( is_singular() && !is_front_page() && ...


4

Although I would advice you to avoid this and use a plugin for this work. Because only a dedicated plugin can help SEO. "WordPress SEO" from yoost is a great plugin for SEO. That being said, here is the code for adding meta description and keywords in header. Paste this in theme's functions.php file. function add_meta_tags() { global $post; if ( ...


3

Below is a small plugin using which you should be able to replace the domain for canonical url to another domain. <?php /* * Plugin Name: WPSE WPSEO Canonical * Plugin URI: http://wordpress.stackexchange.com * Description: Changes canonical url domain. * Author: Sisir * Version: 1.0 * Author URI: http://developerpage.net * **/ ...


3

If your entire page fits in the 4GB LONGTEXT post content field, the limit to the number of pages would be related to the amount of RAM available on your server. When a multipage post is loaded, it is exploded on <!--nextpage--> to put your post into an array of individual pages, so at that point your single page load is consuming at least twice the ...


3

Thought this was a great question so I went digging. In default-filters.php on line 208 there's add_action('wp_head', 'noindex', 1); as of WordPress 4.1. The noindex() function in turn checks to see if you have set blog_public option to 0. If you have, it calls wp_no_robots() which is simply: function wp_no_robots() { echo "<meta name='robots' ...


3

There are different ways to achieve this. Google tries to automatically extract the publish date of an article you wrote. The most common and easiest way for Google is to use rich snippets: http://schema.org/Article See "datePublished" - property for this. After you implemented these little HTML-snippets you can test your markup using the Rich Snippet ...


3

In order to play nicely with Plugins or other code that attempts to modify the HTML document title content (i.e. wp_title() output), you should always and only output this: <title><?php wp_title( '' ); ?></title> ...and if you want to modify that output yourself, filter wp_title instead of hard-coding anything inside the ...


3

I would not trust your SEO contractor on this one. The reason Wordpress does that by default is to attempt to feed search engines a page name that has words in it rather than an arbitrary database location. Google can use the words semantically to attempt to classify the page; whereas, they can't if the page is called ?p=31245 or whatever. Having all those ...


3

To allow crawling of your WP site you need to go to "admin panel >> Settings >> Reading" right before the "Save Changes" button is a checkbox with the label Search Engine Visibility make sure this is unchecked.


3

To get a working nav menu WordPress needs to be set up complete. My suggestion is to use add_feed(). Ignore the name, you get text/html as output. Let's start with code <?php # -*- coding: utf-8 -*- /* Plugin Name: T5 Iframe Nav Menu Description: Display a nav menu in an iframe. Version: 2012.05.18 Refresh the permalinks after activation! */ ...



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