WordPress.org

Ready to get started?Download WordPress

Forums

Append tag list to the_content within the database (1 post)

  1. PinkishHue
    Member
    Posted 1 year ago #

    I'm having some resource issues using the 'Search Everything' plugin, it's causing the mysql database to lock and giving me massive slowdown every day. I don't blame the plugin, I blame my shared hosting - BUT, I was wondering if I could avoid using a plugin at all by simply appending the post tags and category names to the_content within the database so that the in-built WordPress search could then be satisfactory and would find these terms.

    I have read lots of different codex pages and tutorials and not found exactly what I need, but I'm hoping someone could have a look at the following code and give their thoughts on whether it might work (I do not have a test server available at the moment and am hesitant to run it on a live site!)

    function tags_in_content($post_id, $post) {
    
    	$content = get_the_content();
    	$tags = get_tags(); 
    
    	$content->append('$tags');
    }
    
    add_action ( 'publish_post', 'tags_in_content' );

    It can't be that simple can it?

    Many thanks for any help anyone can give me!

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.