Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve aioseop_description filter operations #1474

Closed
EkoJR opened this issue Jan 13, 2018 · 3 comments
Closed

Improve aioseop_description filter operations #1474

EkoJR opened this issue Jan 13, 2018 · 3 comments

Comments

@EkoJR
Copy link
Contributor

EkoJR commented Jan 13, 2018

There is a mixture of double negatives and interesting concepts that make the code rather perplexing, and suspiciously error prone.

  • Apply Filter sends empty( $aioseop_options['aiosp_dont_truncate_descriptions'] ). Which will be false when a variable is set, and true when not in use. See Ref 1.
    • Possible Solution: Send $aioseop_options['aiosp_dont_truncate_descriptions'] variable instead of empty().
    • Redundant if there is a global variable.
    • Seems error prone, but has been set elsewhere; as a string instead of a boolean.
    • Makes not/prevent truncating difficult when making a custom filter.
  • $aioseop_options['aiosp_dont_truncate_descriptions'] uses a double negative. See Ref 2.
    • Possible Solution: Changing to $aioseop_options['aiosp_truncate_descriptions'] would be easier, but flips operations.
    • Flips the coding style.

Ref. 1

Located in All_in_One_SEO_Pack class

$description = apply_filters(
	'aioseop_description',
	$description,
	empty( $aioseop_options['aiosp_dont_truncate_descriptions'] )
);

Ref. 2

Located in All_in_One_SEO_Pack class

public function filter_description( $value, $truncate = false ) {
	/*
	 * Doing stuff...
	 */

	// Truncate / crop
	if ( ! empty( $truncate ) && $truncate )
		$value = $this->trim_excerpt_without_filters( $value );
	// Encode to valid SEO html entities
	return $this->seo_entity_encode( $value );
}

This seems like it may need a new filter, and/or a major update. Since it would potentially change operations for websites using 2 variables in a filter. However, those using 1 variable in the filter hook shouldn't be affected.

Some of the functionality connected to this include...

  • Post Description.
  • OG Description.
  • Google Snippet example ( in Edit Posts ).
@wpsmort
Copy link

wpsmort commented Jan 17, 2018

The aioseop_description filter does need to be separated out so there is a filter for the SEO description and a filter for the OG description. See discussion in #1470.

@wpsmort
Copy link

wpsmort commented Aug 28, 2018

See also #1869

@wpsmort
Copy link

wpsmort commented Apr 8, 2020

Issue moved to awesomemotive/aioseop-pro #797 via ZenHub

@wpsmort wpsmort closed this as completed Apr 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants