Closed pmpr closed 6 years ago
Tried to log the exception and return an empty string in case of possibel exception thrown during fundOneBy
Logging exception to log isn't a common practice in this bundle, but thanks anyway.
@peyman-mohamadpour Actually could you remove the logging part?
Just return null
if meta is not found.
Because no meta found doesn't has to be an exception. It is one of the expected result. In fact if you use Doctrine's getOneOrNullResult()
instead of findOneBy()
method, you won't even get this exception at all.
@peyman-mohamadpour And if logging is indeed needed in your project, you can still do it by checking null.
if (wp_get_attachment_alt_text() == null) { $loggin->log('Error!'); }
Removed the logging part, created another pull request. Would be thankful if you could merge this into the upstream. Regards
Add a twig function to get image alt text from
_wp_attachment_image_alt
post meta key.